How to resolve "Segmentation fault: 11" error when running nodejs? - node.js

I am using Mac OS Yosemite. I use npm install -g n to install the n module to try to upgrade nodejs. Then
I run
n stable
But I received an error during the upgrade and it quit unexpectedly.
Then when I type "node -v" I get an error:
Segmentation fault: 11
In fact I get this error when I type npm install and node so literally I can't use node or npm anymore.
What does it mean? how can I get my node.js back? I tried to reinstall it using
brew install node but after the install I still get the error.

Remove your node modules folder and try to reinstall. Depending on what version of node you were previously running your modules could need to rebuild for compatibility

Related

I want to install and run react-create-app on Ubuntu 20.04

Snap of the error
I tried the command sudo npx create-react-app my-app. It gives Node error regarding version even after I downgraded Node to LTS
I tried to downgrade Node, upgrade NPM, even clear cache of NPM. It still messes up at the Installation.
Please help me out.
Thanks.
Edit:
The versions I'm using are as follows:
Node: v14.15.1
NPM 6.14.9
and running it without sudo still gives the same error.

Unknown error: SyntaxError: Unexpected token 'export' on ng command

I'm trying to learn Angular
I've followed the steps here: https://angular.io/guide/setup-local to get it setup on Ubuntu 18.04.5 LTS
When I try to create a new project with ng new I get an error:
$ node -v
v14.12.0
$ npm -v
6.14.8
$ ng new test
Unknown error: SyntaxError: Unexpected token 'export'
$ ng -v
Unknown error: SyntaxError: Unexpected token 'export'
I installed it via sudo npm install -g #angular/cli which gave no errors.
I've purged node sudo apt-get purge nodejs and reinstalled and removed ng sudo npm remove -g #angular/cli then reinstalled again sudo npm install -g #angular/cli, still get this error. Any ideas?
There was an older version of nodejs on the system originally; I upgraded to 14.x. Export is part of ES6, perhaps it's related? I can't seem to figure it out.
I had the same issue and I could fix it by downgrading node to v12.8.1
You could use nvm as follows:
install nvm
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash
refresh .profile
source ~/.profile
install node v12.8.1
nvm install v12.8.1
check that you are using the 12.8.1 version
nvm list
check ng again
ng -- version
You are using an incompatible NodeJs version. Install a lower version.
More information here (webarchive version).
Check for node versions.
use nvm
brew install nvm
I had the same problem. if you have any other version of Node that might fix it
On the Angular Github
node requirement is below
"engines": {
"node": ">=10.13.0 <13.0.0",
"yarn": ">=1.22.4"
}
after installing the older version
nvm install 12.4.0
then
nvm use 12.4.0
this did the fix for me
For me no solution worked so I uninstalled everything, both the angular and node cli, thinking that it was a version error, but when I typed ng in the console, the error kept appearing so I found where ng was, with whereis ng, delete the file and install all over again.
Run the following command on cmd. This recommends that you always update to the latest patch version, as it contains fixes we released since the initial major release. For example, use the following command to take the latest 10.x.x version and use that to update.
ng update #angular/cli#^<major_version> #angular/core#^<major_version>
First of all Don't run any command which is collected from here and there. Simply follow these steps.
1 uninstall current NodeJS version
2 download lowest version from here.
3 install the lower NodeJS version.
4 restart cmd Promat/terminal and try.
This worked for me.
Have encountered this error many a times in past.
What worked for was removing the package.lock and node_modules & rerun the npm install.
cached code might be causing the trouble.
Install a newer node version and also reinstall angular. For me it did not work with only installing a newer node.

unable to run npm after installing nodejs in windows 10?

i downloaded nodejs and installed with node package manager.
After installing when i typed..
node -v
i am getting response as
v.6.11.1
But when i type
npm -v
i am not gettin any response.then when i give ctrl+c to terminate i am getting response as
Terminate batch job(y/n)?
I have tried reinstalling several times but couldnt able to run npm installation.Any help?
I think node js is not installed properly in your system.
Try to reinstall it and then do this process again.
Follow these steps you will get the node and npm installation successful:
download Nodejs from the link https://nodejs.org/en/
download V6.11.1 LTS (long term support)
type npm install -g #angular/cli in the command promt
check the version now by typing npm -v in the command prompt and node -v
It may not installed properly, Reinstall npm
Try this link https://nodejs.org/en/download/package-manager/

Can't install ExpressJS - npm is throwing an error

When I try to install ExpressJS with the command npm install -g express, I get the following errors:
What can I do about it?
I assume node -v gives 0.10.something.
Get rid of it and install a newer version of node from nodejs.org. Also try removing node_modules and npm install everything again.
Actually, I fixed the problem by uninstalling the latest version and installing the currently recommended one for most users - version 6.9.1.
The cause of the problem still remains unknown.

react-native : cannot find module 'npmlog'

I am trying to install react native on my windows 7 PC,
but unfortunately an error occurred during installation saying
Error: Cannot find module 'npmlog'
npm install -g react-native-cli //Success
react-native init AwesomeProject//missing module
Note that my node version is 4.3.1
What is missing?!.
It sounds like you possibly have a conflict with your npm version and your node version.
Re-installing node usually solves this issue.
I won't list them all, but a google search of the error will throw up hundreds of results. You can try fixing paths yourself, but generally best just to let the node installer handle it.
Re-installing npm may also resolve the issue
npm install -g npm

Resources