npm run Segmentation fault: 11 - node.js

I'm trying to npm run
HOT=1 node ./node_modules/.bin/react-native-webpack-server start --hot
getting this error:
> projectName#0.0.1 hot /Users/user_name/Documents/dev/app
> HOT=1 node ./node_modules/.bin/react-native-webpack-server start --hot
Segmentation fault: 11
there was no such error 12 hours ago. Have no idea why does this happens.

The suggestion to delete node_modules and re-run npm install is a good one. Even better, though: npm rebuild will likely fix the problem and be faster (since it won't actually re-download all the files etc.).

There was a major node.js release yesterday, maybe that's why something went wrong. Best course of action is updating node.js/npm, deleting node_modules folder and running npm install to install dependencies again.

I also had the same issue now in my angularjs webpack project.
I checked the node version and npm
node -v
v8.11.3
npm -v
5.6.0
I updated the npm to the latest.
npm install -g npm#latest
npm -v
6.4.1
Now npm install, npm run build is working fine now. :)

I also got this same error, and was down to a syntax error in one of my SASS files.

I also faced the same issue.
For me it was due to node version mismatch. I tried running node v8 compatible package, but my node version was set to v6.

rm -r node_modules && npm install

Related

npm i not working? npm ERR! Unexpected token '.'

My npm install seems to have stopped working out of nowhere, regardless of if i do npm i or npm install I keep getting an error saying npm ERR! Unexpected token '.' The other npm commands seem to be working perfectly but I can't install any modules because of this error. I'm using npm 8.7.0 and node v14.18.1
The simplest solution I could find and what worked for me was completely removing and unisntalling everything to do with nodejs and npm from my laptop. I then reinstalled it back with no issues and am able to use the command now.
As mentioned in one of the answers, try deleting the node_modules folder and package.lock.json. Use
sudo npm install
And if that doesn't work, what I would suggest is that you use yarn. If you don't know what yarn is, it's just a package manager like node.
You can install yarn by using the following command:
npm install -g yarn
After this make sure all the node modules and package.lock.json is deleted. Now run the command
yarn install
Hopefully, this will fix your issue.

npm ERR! must provide string spec

I'm having this error since a while, in this case, the problem occur executing the following command.
npx create-react-app my-app
Actually, it happens with any npm commands as well, I tried deleting package.json, changing npm versions and yet didn't work, so I'm here asking for help.
This is the entire error:
C:\Users\c>npm install
npm ERR! must provide string spec
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\c\AppData\Local\npm-cache\_logs\2022-01-28T16_50_23_009Z-debug.log
Version of npm and node:
node --version
v16.13.2
npm --version
8.3.2
I had the same issue, it was a missing version in my package.json
look like mistakenly I removed some text
"dependencies":{
"angular/cli" :"{}"
}
try to update your npm: npm upgrade
then: npm clean cache
Following, i'm in the exact same position. Tried changing the NodeJS version using NVM and now some of the commands work (npm -v shows im running 8.1.0) but npm update and npm/npx create-react-app give me an " ERR! must provide string spec " !
I faced this same issue yesterday.
This is what I did to resolve it:
Uninstalling node entirely and removing node_modules and package.lock.json from the project directory.
Install node afresh and run npm install in your project directory.
I tried to reactivate an old project which had packages noted down differently then usual in package.json. They had an id and locator parameter, like:
"ImagePicker": {
"id": "ImagePicker",
"locator": "https://github.com/dhavalsoni2001/ImagePicker.git"
}
After removing / replacing them by version numbes, i could install.

Need to install 'webpack-dev-server'

I have cloned a repo from GitHub for a project. I've already installed node (-v 14.17.5) and npm (-v7.20.6), however when I run npm start I get the following code. I've tried reinstalling node and npm several times but I keep getting the same error:
$ npm start
> simplefolio#1.0.1 start
> webpack server --config webpack.dev.js --open
[webpack-cli] You need to install 'webpack-dev-server' for running 'webpack serve'.
Error: Cannot find module 'webpack-dev-server/bin/cli-flags'
Require stack:
- C:\Users\edwin\Desktop\git\simplefolio\node_modules\#webpack-cli\serve\lib\index.js
- C:\Users\edwin\Desktop\git\simplefolio\node_modules\webpack-cli\lib\webpack-cli.js
- C:\Users\edwin\Desktop\git\simplefolio\node_modules\webpack-cli\lib\bootstrap.js
- C:\Users\edwin\Desktop\git\simplefolio\node_modules\webpack-cli\bin\cli.js
- C:\Users\edwin\Desktop\git\simplefolio\node_modules\webpack\bin\webpack.js
Remove node_modules and package-lock.json, then npm i again
Remove node modules, then npm i again
In my case, I have node 16.13.0 and npm 7.20.1. Removing nodes_modules, package-lock.json and run npm cache clean --force alone didn't help. The key change for me is upgrading npm version to the latest (8.7.0), then combining with clean install.

Error " ERR_OUT_OF_RANGE" when using npm install

I tried to create a new NodeJs project, when i ran "npm init" the package.json was created successfully but when I tried to run "npm install express" it showed "npm ERR! code ERR_OUT_OF_RANGE". I am not able to run npm install without getting this error.
I tried to install other packages, i tried sudo, and I removed npm/node and reinstalled nvm/node but it is still the same.
Thank you for your help !
npm install express
npm ERR! code ERR_OUT_OF_RANGE
npm ERR! The value of "err" is out of range. It must be a negative integer. Received 536870212
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/me/.npm/_logs/2019-09-18T14_49_07_222Z-debug.log
The issue is a mismatch between your versions of Node and NPM.
This can occur when one is updated without the other.
To prevent these issues, use nvm to manage your Node version:
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.1/install.sh | bash
# Example: Selecting Node v13
# For complete list of available versions run `nvm ls-remote`
nvm install 13
nvm use 13
This will select matching versions of Node and NPM.
This error was caused by a the most recent version of node which was 12.10.0, when I installed and used the 10.16.0 version of node, the error was gone.
i ran into something very similar with react native - metro and it seems I just had to deactivate my firewall LULU.

"libsass bindings not found. Try reinstalling node-sass"

So today I was trying to install MeepBot for StreamMe, and I ran into the error that says: "'libsass' bindings not found. Try reinstalling 'node-sass'." I reinstalled it like a million times. I have tried: "npm un/install --save-dev node-sass," "npm rebuild node-sass," etc. Can someone please give me an answer to my problem?
Picture: http://prntscr.com/axbxu8
P.S. keep in mind, I am using CentOS 6.
According to node-sass project's README.md only binaries for "popular platforms"(i.e. Windows/Mac) are included and you may need to build for other platforms like CentOS.
Here are roughly the steps (reading the readme would give you a better idea):
- cd to the node-sass directory within your project source.
- node scripts/install.js
- node scripts/build.js
Should see a message like Binary is fine; exiting.
Try to run npm rebuild node-sass again and it should work!
have you tried reinstalling everything? rm -rf node_modules; npm i. i've had to do that multiple times before.
otherwise, npm rebuild node-sass should work unless there are multiple versions of node-sass in your dependency tree - then maybe not. are you using npm v3+?
I would suggest try upgrading your gcc compiler as node-sass uses gcc to compile. And then try this -
npm rebuild node-sass
If that doesn't work then try runing this code (you must be using node version 4 or above).
npm install -g n
rm -R node_modules/
npm uninstall --save-dev node-sass
npm install --save-dev node-sass#2
npm install
npm -g install node-gyp#3
npm rebuild node-sass
If you are using multiple version of node then you will have to run npm rebuild node-sass every time you change node version.
You can also use gulp-sass npm install gulp-sass#2 if you want.
I was facing this issue. In my case the parent package.json was referring to new version of node-sass but the version of gulp-sass was referring to old node-sass. As soon as I updated gulp-sass to latest version, and ran 'npm rebuild node-sass', issue was gone.

Resources