npm npm run watch-poll error for homestead - node.js

I am trying to use npm for a project I am working on in Homestead however I am getting some errors.
I ran
npm run watch-poll
but I get this error
vagrant#homestead:~/code/testlaravel$ npm run watch-poll
> # watch-poll /home/vagrant/code/testlaravel
> npm run watch -- --watch-poll
> # watch /home/vagrant/code/testlaravel
> npm run development -- --watch "--watch-poll"
> # development /home/vagrant/code/testlaravel
> cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress
--hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js "--watch" "--watch-poll"
sh: 1: cross-env: not found
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! # development: "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js "--watch" "--watch-poll""
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the # development 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/vagrant/.npm/_logs/2019-02-18T14_11_57_194Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! # watch: "npm run development -- --watch "--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/vagrant/.npm/_logs/2019-02-18T14_11_57_246Z-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/vagrant/.npm/_logs/2019-02-18T14_11_57_290Z-debug.log
I'm new to npm and I have no idea what to do and I have not found anyone online with a similar problem.
npm version = 6.7.0
node version = v10.15.1
If you need it.
I would appreciate any help, also if you need anymore info about what i'm running and how things are set up let me know.
edit 1
running
npm install
gives this result
vagrant#homestead:~/code/testlaravel$ npm install
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: minimist#1.2.0 (node_modules/fsevents/node_modules/rc/node_modules/minimist):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, open '/home/vagrant/code/testlaravel/node_modules/fsevents/node_modules/rc/node_modules/minimist/package.json.3101396508'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#1.2.7 (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#1.2.7: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
audited 11757 packages in 87.877s
found 2 vulnerabilities (1 low, 1 high)
run `npm audit fix` to fix them, or `npm audit` for details
edit 2
Ok so I ran
sudo npm i -g cross-env
because I got a permissions error without the sudo bit, and it looks like it worked.
However I am getting a new error now
ERROR Failed to compile with 2 errors 3:18:10 PM
error in ./resources/assets/sass/app.scss
error in ./resources/assets/sass/app.scss
I guess this is a problem with the my code/framework (i'm using laravel) but yes sudo npm i -g cross-env looks like it fixed it.

You have missing module cross-env. Run:
npm i -g cross-env
to install cross-env globally.

Related

I can't install npm or node js in my git bash folder named phaser3-project-template

whenever I type npm install in my git bash terminal there is an error that says
> uglifyjs-webpack-plugin#0.4.6 postinstall C:\Users\Bea Beangca\Desktop\phaser\phaser3-project-template\node_modules\uglifyjs-webpack-plugin
> node lib/post_install.js
'node' is not recognized as an internal or external command,
operable program or batch file.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#1.2.4 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#1.2.4: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! uglifyjs-webpack-plugin#0.4.6 postinstall: `node lib/post_install.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the uglifyjs-webpack-plugin#0.4.6 postinstall 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\Bea Beangca\AppData\Roaming\npm-cache\_logs\2021-09-08T06_30_15_228Z-debug.log
And when I type ls in my git bash terminal, it will show that I downloaded node_modules
$ ls
LICENSE README.md assets/ build/ index.html node_modules/ package-lock.json package.json src/ webpack.config.js
$ npm run start
> phaser3-project-template#1.0.9 start C:\Users\Bea Beangca\Desktop\phaser\phaser3-project-template
> npm run build && webpack-dev-server --port=8000
'npm' is not recognized as an internal or external command,
operable program or batch file.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! phaser3-project-template#1.0.9 start: `npm run build && webpack-dev-server --port=8000`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the phaser3-project-template#1.0.9 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\Bea Beangca\AppData\Roaming\npm-cache\_logs\2021-09-08T06_34_12_381Z-debug.log
It looks like your git bash doesn't have node installed. I only think that because it says npm is not recognized as an internal or external command
If I'm correct I believe your solution would be to install either nvm or nodejs. Are you using Windows?

unable to install and run nodemon npm - Nodejs

i am unable to run my nodejs project , getting the below error.
> restfullnodejs#1.0.0 start C:\Users\PC\restfullnodejs
> nodemon app.js
npm ERR! code ELIFECYCLE
npm ERR! syscall spawn C:\Users\PC\restfullnodejs\git\bin\bash.exe
npm ERR! file C:\Users\PC\restfullnodejs\git\bin\bash.exe
npm ERR! path C:\Users\PC\restfullnodejs\git\bin\bash.exe
npm ERR! errno ENOENT
npm ERR! restfullnodejs#1.0.0 start: `nodemon app.js`
npm ERR! spawn C:\Users\PC\restfullnodejs\git\bin\bash.exe ENOENT
npm ERR!
npm ERR! Failed at the restfullnodejs#1.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\PC\AppData\Roaming\npm-cache\_logs\2020-07-01T13_04_14_121Z-debug.log
My guess is the error with nodemon , if so how do i resolve this issue . Unable to install nodemon too
Update
After deleting package-lock.json file and nodemodules folder tried npm clear cache --force then npm install - g nodemon
then getting below error
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#~2.1.2 (node_modules\nodemon\node_modules\chokidar\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#2.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm ERR! code ELIFECYCLE
npm ERR! syscall spawn C:\Users\PC\restfullnodejs\git\bin\bash.exe
npm ERR! file C:\Users\PC\restfullnodejs\git\bin\bash.exe
npm ERR! path C:\Users\PC\restfullnodejs\git\bin\bash.exe
npm ERR! errno ENOENT
npm ERR! nodemon#2.0.4 postinstall: `node bin/postinstall || exit 0`
npm ERR! spawn C:\Users\PC\restfullnodejs\git\bin\bash.exe ENOENT
npm ERR!
npm ERR! Failed at the nodemon#2.0.4 postinstall 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\PC\AppData\Roaming\npm-cache\_logs\2020-07-01T14_10_55_492Z-debug.log
This is a common issue on PC/Windows;
Try:
Deleting the package-lock.json, and node_modules folder.
Run 'npm install' from the root folder for your app.
Run 'npm install -g nodemon'

laravel npm run production Compiled successfully,but npm ERR! code ELIFECYCLE

npm run dev
was successful.
npm run prod
was unsuccessful with:
ERR! code ELIFECYCLE
npm log message after npm run prod:
DONE Compiled successfully in 91052ms 8:46:32 AM
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! # production: `cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --no-progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the # production 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! /root/.npm/_logs/2020-03-13T08_46_33_901Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! # prod: `npm run production`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the # prod 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! /root/.npm/_logs/2020-03-13T08_46_33_920Z-debug.log
To maintain team`s package version consistency,package version is fixed in package-lock.json.
What is the problem?
You could try to clear the npm cache and by deleting the node_module folder.
Remove npm Cache
$ npm cache clean --force
Delete node_modules by
$ rm -rf node_modules package-lock.json
Or delete it manually.
And then run
$ npm install

Laravel Mix npm run watch fails

I'm trying to compile laravel sass files to apply the changes but every time i run (npm run watch) or (npm run dev) i get these errors...
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! # development: cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js "--watch"
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the # development 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\User\AppData\Roaming\npm-cache_logs\2019-01-01T14_42_14_962Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! # watch: npm run development -- --watch
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! C:\Users\User\AppData\Roaming\npm-cache_logs\2019-01-01T14_42_15_042Z-debug.log
The problem is with this error is there are no node_modules.
As the Laravel Mix Documentation states:
You have to run npm install to download all the required packages for Laravel Mix.
If you have node_module folder then delete it and run npm install again.
vue-loader is a loader for webpack that allows you to author Vue components in a format.
Please run the command.
npm i vue-loader

npm install failed at the nodemon#1.18.9 postinstall script

the commands 'npm install' gives me the following error:
> nodemon#1.18.9 postinstall C:\Users\Nikhil\Music\tab-tracker\server\node_modules\nodemon
> node bin/postinstall || exit 0
npm WARN server#1.0.0 No description
npm WARN server#1.0.0 No repository field.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#1.2.4 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#1.2.4: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm ERR! file bashcls
npm ERR! path bashcls
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn bashcls
npm ERR! nodemon#1.18.9 postinstall: `node bin/postinstall || exit 0`
npm ERR! spawn bashcls ENOENT
npm ERR!
npm ERR! Failed at the nodemon#1.18.9 postinstall 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\Nikhil\AppData\Roaming\npm-cache\_logs\2018-12-16T19_09_40_364Z-debug.log
As can be seen from the error messages, npm install fails at nodemon#1.18.9 postinstall script.
I've tried things like, deleting the node_modules folder and re-running the 'npm install' command again, the same error appears.
Also, i tried cleaning the npm cache as suggested by this answer, and it didn't work. Trying to separtely install nodemon gives the same error as above.
I have the same problem while I installing
nodemon
in devDependencies for my existing projects in different computer.
I do a research and found a solution that helped me to solved this kind for problem. It's happening because of security issues depending on your OS.
Solve this by :
npm install -g nodemon --unsafe-perm=true --allow-root
PS :
This too can happen in Electron also, so u can solve by -
npm install -g electron --unsafe-perm=true --allow-root

Resources