Why I can not run Npm run dev? - npm

Guys can you please help me on this I have trouble run npm run dev for my Laravel Mix. I followed links below but still error exist. Do i have a problem on my OS? I tried to remove node_modules, run npm install --global cross-env. and run NPM install again.
'cross-env' is not recognized as an internal or external command,
https://github.com/JeffreyWay/laravel-mix/issues/478
The error I always get when I ran npm run dev :
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`
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! /Users/baloghdominik/.npm/_logs/2020-02-26T17_05_54_290Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! # dev: `npm run development`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the # 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! /Users/baloghdominik/.npm/_logs/2020-02-26T17_05_54_315Z-debug.log

First run
npm install cross-env
npm install
Then run
npm run dev

Simple steps :
npm cache clear --force
delete node_modules and package-lock.json
npm install
npm run dev

rm -rf node_modules
rm package-lock.json yarn.lock
npm cache clear --force
npm install
Basically delete the node_modules folder and package-lock.json file , clear cache and do an npm install. Worked for me.

In my case I had old version of node.js
so I just installed version I need:
sudo npm install n -g
sudo n stable
Or can try use latest:
sudo n latest

If u using nvm, u need use version for project. Commands helped for me:
Use default version node: nvm use system
Remove node_modules rm -rf node_modules and rm -f package-lock.json
Clear cache npm cache clear --force
Finished command npm i

Related

Got errs with puppeteer and node-sass running npm i

I have a double problem.
The work environment is in Vue and Nuxt, with a mac M1 pro.
Until last week, I had no problems, everything was running perfect. They changed my mac and the world stopped running.
I download 2 repos, but when running npm i, one explodes with puppeteer and the other with node-sass.
npm ERR! code ELIFECYCLE npm ERR! error 1 npm ERR! puppeteer#8.0.0 install:nodeinstall.js npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the puppeteer#8.0.0 install script.
npm ERR! code ELIFECYCLE npm ERR! error 1 npm ERR! node-sass#4.14.1 postinstall: node scripts/build.js npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the node-sass#4.14.1 postinstall script.
I am using the correct version of Node.
I tried deleting the package-lock.json and the node_modules, clearing the npm cache, and running npm i again, and no, it breaks.
I tried installing those specific packages outside of npm i, and I get the same error.
I tried creating a .npmrc file with
registry=https://registry.npmjs.org always-auth=true //registry.npmjs.org/: "token"
I am using the same package.json and the same repos as my peers. They also have mac M1 and have no problem.
On Github we have the same permissions.
Any idea what is happening?
Thank you very much in advance \o/
You can use sass instead of node-sass. This is because node-sass has been deprecated.
npm uninstall node-sass
npm install sass
Works all the same, no need to make any other changes

Trying to update to latest NPM version but existence of npx is blocking it

I would like to update to the latest npm version on a mac, so of course I ran
npm install -g npm#latest
but I got the following error message
rm not removing /usr/local/bin/npm as it wasn't installed by /usr/local/lib/node_modules/npm
npm WARN rm not removing /usr/local/bin/npx as it wasn't installed by /usr/local/lib/node_modules/npm
npm ERR! code EEXIST
npm ERR! syscall symlink
npm ERR! path ../lib/node_modules/npm/bin/npx-cli.js
npm ERR! dest /usr/local/bin/npx
npm ERR! errno -17
npm ERR! EEXIST: file already exists, symlink '../lib/node_modules/npm/bin/npx-cli.js' -> '/usr/local/bin/npx'
npm ERR! File exists: /usr/local/bin/npx
npm ERR! Remove the existing file and try again, or run npm
npm ERR! with --force to overwrite files recklessly.
Ok, I would like to not run --force to overwrite files recklessly - so how do I get npm to install the latest version in this case?

NPM completely broken and won't reinstall after failed upgrade

Mac Catalina 10.15.6
I already had npm installed. I wanted to upgrade so I ran the following.
npm install -g npm
Below is the output:
$name#$names-MacBook-Pro desktop % npm install -g npm
/usr/local/bin/npx -> /usr/local/lib/node_modules/npm/bin/npx-cli.js
/usr/local/bin/npm -> /usr/local/lib/node_modules/npm/bin/npm-cli.js
npm ERR! code EEXIST npm ERR! syscall symlink npm ERR! path
../../../lib/node_modules/npm/man/man1/npm-bin.1 npm ERR! dest
/usr/local/share/man/man1/npm-bin.1 npm ERR! errno -17 npm ERR!
EEXIST: file already exists, symlink
'../../../lib/node_modules/npm/man/man1/npm-bin.1' ->
'/usr/local/share/man/man1/npm-bin.1' npm ERR! File exists:
/usr/local/share/man/man1/npm-bin.1 npm ERR! Remove the existing file
and try again, or run npm npm ERR! with --force to overwrite files
recklessly.
npm ERR! A complete log of this run can be found in: npm ERR!
/Users/$name/.npm/_logs/2020-10-04T14_41_02_611Z-debug.log
Now all NPM commands fail.
zsh: command not found: npm
Everything from:
npm -v
sudo npm install npm -g
I just used home brew to upgrade NPM and it deleted and reinstalled all the necessary files.
This generally works for me on Mac:
brew upgrade
brew cleanup
brew install npm
(note you'll need the xcode tools if you don't have it - try xcode-select --install or check out this answer.)
Now, try npm install again and see if that changes anything.
Also, see this potentially related answer.

error while running "npm run build" in vue application

I have cloned vue application from git hub(https://github.com/jimmerioles/progressive-weather-app), for automating the deployment in jenkins. Before doing it, i am checking in my ubuntu machine(GCP vm). There i have installed java,nodejs, npm and vuecli. When i execute a command "npm run build" getting the below error. I tried re-installing vuecli, nodejs and npm also., still getting the same error. Kindly let me know how can i fix this.
npm version is "6.2.0", nodejs version is "v14.3.0" and vuecli is a latest one.
root#instance-2:~/weather/src# npm run build
> PWeatherApp#0.1.0 build /root/weather
> vue-cli-service build
sh: 1: vue-cli-service: not found
npm ERR! code ELIFECYCLE
npm ERR! syscall spawn
npm ERR! file sh
npm ERR! errno ENOENT
npm ERR! PWeatherApp#0.1.0 build: `vue-cli-service build`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the PWeatherApp#0.1.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm WARN Local package.json exists, but node_modules missing, did you mean to install?
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2020-05-23T18_32_20_092Z-debug.log
its may help you:
npm install -g #vue/cli
# OR
yarn global add #vue/cli

gulp-sass npm ERR! Failed at the node-sass#4.9.0 install script

Im trying to install gulp-sass from terminal window in visual studio code.
other dependencies like autoprefixer, concat etc install without a problem, but gulp-sass keeps giving me this error.
> node-sass#4.9.0 install /usr/local/lib/node_modules/node-sass
> node scripts/install.js
sh: node: command not found
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! node-sass#4.9.0 install: `node scripts/install.js`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the node-sass#4.9.0 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
Im running VSC on a mac.
Any help please? I am completely new at all this btw, no programming background, just front end dev.
Thanks a lot
I have the same problem. And I found this solution:
sudo npm install -g node-sass#4.5.3 --unsafe-perm = true --allow-root
I just changed part of the code:
sudo npm install gulp-sass --unsafe-perm = true --allow-root
It worked for me.
[npm install -g node-sass#4.5.3 --unsafe-perm=true --allow-root]
This one did work for me to install the package but it failed again when I start the application
I tried with the [yarn install] instead of [npm install]
The app started successfully.
I get the same solution as you. and I tried searching on the internet and I found here http://relaxitblog.com/?p=611
then after that I installed: sudo npm install gulp-sass
after that: npm audit fix
success