Laravel-mix - BrowserSync throwing an error at event.js:160 - node.js

Not sure if the problem is related to laravel-mix, but I am having problem with Browsersync package. Here is my mix.js:
mix.js('resources/assets/js/app.js', 'public/js')
.browserSync({proxy: 'localhost:8000'})
.sass('resources/assets/sass/app.scss', 'public/css');
When I run npm run watch-poll ( watch doesn't pick up the changes, hence the watch-poll see here ) I get the following error on the console:
[Browsersync] Watching files...
events.js:160
throw er; // Unhandled 'error' event
^
Error: watch resources/views/auth/passwords ENOSPC
at exports._errnoException (util.js:1020:11)
at FSWatcher.start (fs.js:1443:19)
at Object.fs.watch (fs.js:1470:11)
at createFsWatchInstance (/home/tanmay/LVProjects/learningdemo/node_modules/chokidar/lib/nodefs-handler.js:37:15)
at setFsWatchListener (/home/tanmay/LVProjects/learningdemo/node_modules/chokidar/lib/nodefs-handler.js:80:15)
at FSWatcher.NodeFsHandler._watchWithNodeFs (/home/tanmay/LVProjects/learningdemo/node_modules/chokidar/lib/nodefs-handler.js:228:14)
at FSWatcher.NodeFsHandler._handleDir (/home/tanmay/LVProjects/learningdemo/node_modules/chokidar/lib/nodefs-handler.js:407:19)
at FSWatcher.<anonymous> (/home/tanmay/LVProjects/learningdemo/node_modules/chokidar/lib/nodefs-handler.js:455:19)
at FSWatcher.<anonymous> (/home/tanmay/LVProjects/learningdemo/node_modules/chokidar/lib/nodefs-handler.js:460:16)
at FSReqWrap.oncomplete (fs.js:123:15)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! # watch: `cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --watch --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js "--watch-poll"`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the # watch script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/tanmay/.npm/_logs/2017-08-07T07_02_31_677Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! # watch-poll: `npm run watch -- --watch-poll`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the # watch-poll script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/tanmay/.npm/_logs/2017-08-07T07_02_31_725Z-debug.log
I am on: Ubuntu 16.04.3 (Not a VM). Running: Nodejs v6.11.2, NPM v5.3.0
When I comment out the .browserSync() call from my mix.js:
mix.js('resources/assets/js/app.js', 'public/js')
// .browserSync({proxy: 'localhost:8000'})
.sass('resources/assets/sass/app.scss', 'public/css');
however, the error no longer persists. How do I get around the problem? Please feel free to ask any other necessary information.
Here is my package.json file
UPDATE: This error doesn't occur on a new laravel project. To get the same result as a new project, this is what I did:
I removed the node modules: rm -rf node_modules I removed the package-lock.json file: rm package-lock.json I re-run: npm install, npm run dev, npm run watch-poll
Result: still same error :(

This might be due to another task running on port 4040 already.
You can try killall -9 node
Source/more details: https://github.com/parse-community/parse-dashboard/issues/401#issuecomment-224007436

I suspect it's the same problem that is shown & with working solution from Gulp Error: watch ENOSPC
Try this: Why this issue occured? There is the limit in the number of
files that can be watched in a system. We have to increase this
number. The below command can be used to increase this number.
$ echo fs.inotify.max_user_watches=582222 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p

Related

simple react works with npm start but not with nohup npm start &

I tested with a simple app generated by
npx create-react-app myfirstreact
It works fine with
npm start
but if I try to run it in the background with
nohup npm start &
I get
Starting the development server...
events.js:174
throw er; // Unhandled 'error' event
^
Error: EBADF: bad file descriptor, read Emitted 'error' event at:
at lazyFs.read (internal/fs/streams.js:165:12)
at FSReqWrap.wrapper [as oncomplete] (fs.js:467:17) npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! myfirstreact#0.1.0 start:
react-scripts start npm ERR! Exit status 1 npm ERR! npm ERR! Failed
at the myfirstreact#0.1.0 start script. npm ERR! This is probably not
a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in: npm ERR!
/home/jglickman/.npm/_logs/2020-10-06T04_43_39_480Z-debug.log
Try running it like this:
nohup node scripts/start.js
I think this post will help too.

npm - How to fix error code ELIFECYCLE after updating #angular/cli

I have this error after updating #angular/cli both global and local to the latest version. I've tried cleaning cache, deleting node modules folder and reinstalling but the error still persists. Hope someone knows how to fix this.
Here is the full console log when I ran npm after updating:
PS D:\KIS\Name-Card-Frontend-Project> npm start
name-card-angular#0.0.0 start D:\KIS\Name-Card-Frontend-Project
ng serve --host 0.0.0.0 --proxy-config proxyconfig.json
trustedSubscriber._addParentTeardownLogic is not a function
TypeError: trustedSubscriber._addParentTeardownLogic is not a function
at MergeMapSubscriber.Subscriber [as constructor] (D:\KIS\Name-Card-Frontend-Project\node_modules\rxjs\internal\Subscriber.js:45:43)
at MergeMapSubscriber.OuterSubscriber [as constructor] (D:\KIS\Name-Card-Frontend-Project\node_modules\rxjs\internal\OuterSubscriber.js:20:42)
at new MergeMapSubscriber (D:\KIS\Name-Card-Frontend-Project\node_modules\rxjs\internal\operators\mergeMap.js:48:28)
at MergeMapOperator.call (D:\KIS\Name-Card-Frontend-Project\node_modules\rxjs\internal\operators\mergeMap.js:39:33)
at Observable.subscribe (D:\KIS\Name-Card-Frontend-Project\node_modules\rxjs\internal\Observable.js:24:22)
at D:\KIS\Name-Card-Frontend-Project\node_modules\#angular\cli\node_modules\rxjs\internal\util\subscribeToObservable.js:10:20
at Object.subscribeToResult (D:\KIS\Name-Card-Frontend-Project\node_modules\#angular\cli\node_modules\rxjs\internal\util\subscribeToResult.js:7:45)
at MergeMapSubscriber._innerSub (D:\KIS\Name-Card-Frontend-Project\node_modules\#angular\cli\node_modules\rxjs\internal\operators\mergeMap.js:75:38)
at MergeMapSubscriber._tryNext (D:\KIS\Name-Card-Frontend-Project\node_modules\#angular\cli\node_modules\rxjs\internal\operators\mergeMap.js:72:14)
at MergeMapSubscriber._next (D:\KIS\Name-Card-Frontend-Project\node_modules\#angular\cli\node_modules\rxjs\internal\operators\mergeMap.js:55:18)
at MergeMapSubscriber.Subscriber.next (D:\KIS\Name-Card-Frontend-Project\node_modules\#angular\cli\node_modules\rxjs\internal\Subscriber.js:64:18)
at MapSubscriber._next (D:\KIS\Name-Card-Frontend-Project\node_modules\#angular\cli\node_modules\rxjs\internal\operators\map.js:52:26)
at MapSubscriber.Subscriber.next (D:\KIS\Name-Card-Frontend-Project\node_modules\#angular\cli\node_modules\rxjs\internal\Subscriber.js:64:18)
at TapSubscriber._next (D:\KIS\Name-Card-Frontend-Project\node_modules\#angular\cli\node_modules\rxjs\internal\operators\tap.js:62:26)
at TapSubscriber.Subscriber.next (D:\KIS\Name-Card-Frontend-Project\node_modules\#angular\cli\node_modules\rxjs\internal\Subscriber.js:64:18)
at MergeMapSubscriber.notifyNext (D:\KIS\Name-Card-Frontend-Project\node_modules\#angular\cli\node_modules\rxjs\internal\operators\mergeMap.js:84:26)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! name-card-angular#0.0.0 start: ng serve --host 0.0.0.0 --proxy-config proxyconfig.json
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the name-card-angular#0.0.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Dell\AppData\Roaming\npm-cache_logs\2018-09-21T17_34_25_541Z-debug.log
UPDATE
The error disappeared after commenting the _addParentTeardownLogic function from the file at the link above. There're some times the code works fine when commenting error function of the modules. Really don't know why they added these functions just to be commented?

babel-watch server.js fails when running npm run dev

Im currently working thru a tutorial, and have noticing that when running npm run dev, the babel-watch server.js continues to fails. I have uninstalled/reinstalled babel-cli babel-preset-env and babel-watch without success. The output of the error is
npm run dev
> back-end#1.0.0 dev /home/pietto/back-end
> babel-watch server.js
Watcher failure { Error: watch server.js ENOSPC
at FSWatcher.start (fs.js:1382:19)
at Object.fs.watch (fs.js:1408:11)
at createFsWatchInstance (/home/pietto/back-end/node_modules/chokidar /lib/nodefs-handler.js:37:15)
at setFsWatchListener (/home/pietto/back-end/node_modules/chokidar/lib/nodefs-handler.js:80:15)
at FSWatcher.NodeFsHandler._watchWithNodeFs (/home/pietto/back-end/node_modules/chokidar/lib/nodefs-handler.js:228:14)
at FSWatcher.NodeFsHandler._handleFile (/home/pietto/back-end/node_modules/chokidar/lib/nodefs-handler.js:255:21)
at FSWatcher.<anonymous> (/home/pietto/back-end/node_modules/chokidar /lib/nodefs-handler.js:473:21)
at FSReqWrap.oncomplete (fs.js:153:5)
errno: 'ENOSPC',
code: 'ENOSPC',
syscall: 'watch server.js',
filename: 'server.js' }
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! back-end#1.0.0 dev: `babel-watch server.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the back-end#1.0.0 dev script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/pietto/.npm/_logs/2018-10-12T19_20_06_169Z-debug.log
After some review, it was determined that I had multiple babel.rc process running in the background. Once I killed those process, worked well

Angular2 Quickstart lite-server crashes

Good Morning people from the Internet,
Intro
While following the Angular2 Quickstart guide I have experienced many times issues where lite-server would crash just after executing npm start. Crash would look like this in your terminal:
ERR! Linux 3.19.0-51-generic
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "run" "lite"
npm ERR! node v5.7.0
npm ERR! npm
v3.8.2
npm ERR! code ELIFECYCLE
npm ERR! angular2-quickstart#1.0.0 lite: `lite-server`
npm ERR!
Exit status 1
npm ERR!
npm ERR! Failed at the angular2-quickstart#1.0.0 lite script 'lite-server'.
npm
ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the angular2-quickstart package,
npm ERR! not with npm itself.
npm ERR!
Tell the author that this fails on your system:
npm ERR! lite-server
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs angular2-quickstart
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls angular2-quickstart
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /home/oscar/dev/cw/npm-debug.log
Most common reasons (and solutions)
Most of the time the reason was one of the two:
lite-server was not shutdown properly. Solution: Killing all npm / node instances and restarting the server with npm start would do the trick.
dependencies are not up to date. Solution: simply deleting the node_modules directory, executing npm install to rebuild the dependencies would do the trick.
Other issue
However when reaching the step called 6.Routing the issue was a bit different. This time instead of crashing straightaway it was failing after typescript compilation:
16.03.15 16:33:49 200 GET /index.html
events.js:154
throw er; // Unhandled 'error' event
^
Error: watch node_modules/angular2/es6/prod/examples/platform/dom/debug/ts/debug_element_view_listener ENOSPC
at exports._errnoException (util.js:856:11)
...
at FSReqWrap.oncomplete (fs.js:82:15)
I have found the cause of the crash. And I felt like sharing the path so it might help others because there are many forum / stackoverflow threads around the same sort of issue but none solved this crash.
Basically, I looked at the stack trace to find which "module" was failing. Here it is
at FSReqWrap.oncomplete (fs.js:82:15)
and the solution was to execute the following command (see this ticket):
echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p
but instead of just executing it, I needed to understand why setting to 524288 the config item fs.inotify.max_user_watches into /etc/sysctl.conf which is after a system file. I found the answer here where it says and I quote:
Nodejs would report an error if there's too many files for watching due to system limitation, on Linux you can change that by adding fs.inotify.max_user_watches = 524288 to the file etc/sysctl.conf and restart the process
Hope it helps.

Error starting NPM .. Ghost Blog .. error npm start

********** Update *********
This had to do with me changing my ports to those of my ipaddress in config.js so I can test on mobile and table. Any idea how I can do this without changing the ports everytime I reboot the computer so that they are always set to my ipaddress for testing?
**********Original Question ****
I am getting a strange error when starting npm to run my ghost blog. It has happened before and I went back to a previous commit on github. It seems like everytime I get it working through a different method and then stop working and close terminal. Then when I restart its another issues?? Maybe github is causing it. Any help would be great. Tried everything I know how to do.
here is the error message:
cconti77#Charless-iMac ~/sites/_repos/elite-university (get-back-on-it●●●)$ npm start
ghost#0.5.0 start /Users/cconti77/Sites/_repos/elite-university
node index
Migrations: Up to date at version 003
events.js:72
throw er; // Unhandled 'error' event
^
Error: listen EADDRNOTAVAIL
at errnoException (net.js:904:11)
at Server._listen2 (net.js:1023:19)
at listen (net.js:1064:10)
at net.js:1146:9
at dns.js:72:18
at process._tickCallback (node.js:419:13)
at process._tickFromSpinner (node.js:394:15)
npm ERR! ghost#0.5.0 start: `node index`
npm ERR! Exit status 8
npm ERR!
npm ERR! Failed at the ghost#0.5.0 start script.
npm ERR! This is most likely a problem with the ghost package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node index
npm ERR! You can get their info via:
npm ERR! npm owner ls ghost
npm ERR! There is likely additional logging output above.
npm ERR! System Darwin 13.4.0
npm ERR! command "node" "/usr/local/bin/npm" "start"
npm ERR! cwd /Users/cconti77/Sites/_repos/elite-university
npm ERR! node -v v0.10.32
npm ERR! npm -v 1.4.28
npm ERR! code ELIFECYCLE
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /Users/cconti77/Sites/_repos/elite-university/npm-debug.log
npm ERR! not ok code 0
You are already using the Ghost port for something else.
Most probably ghost exited the wrong way, or you are using forever/pm2 and the process hasn't closed properly. try killing any 'forever/pm2' instances, then reboot your machine. Worked for me.
To understand what happens, I suggest you try the following to see which process uses the ghost port, then kill the process. http://www.cyberciti.biz/faq/what-process-has-open-linux-port/
And also, you're a bit off-topic, this should be moved to SuperUser.

Resources