Node.js error : failed to initialize context - node.js

I just installed Node.js from Visual Studio installation.
When I tried to call node on the command prompt, I got this error. I also got this when I tried to do npm init and npm install
How do I fix this?

I encountered this problem on my Windows 10 64-bit computer. From looking at Programs and Features, I saw that I had Node.js and Node.js Chakra installed. I uninstalled Node.js and then downloaded and installed again it from https://nodejs.org/en/download/.
This, however, did not fix the problem. So I uninstalled Node.js Chakra; and when I opened a new command prompt, node and npm were working.
However, I'm not sure if I needed to uninstall and reinstall Node.js or if I only needed to uninstall Chakra. I probably should have uninstalled Chakra first and node and npm might have worked after that.

Related

Npm isn't getting automatically installed on installing node.js

While hosting my webapp on heroku I got a message of some bugs in my npm package, my npm package was of version 3 and node.js was of version 8, I wrote thinking that I can update my npm version I tried to update it but the version remained same so I decided to uninstall it and wrote the command "npm uninstall " and than again tried to install npm but in vain ,finally I uninstalled my node.js and reinstalled tha npm will automatically get installed with it, but this too didn't work now I have node of version 10 with no npm which I got to know by checking version of npm which gave me message of "command not found ", now my every try to install npm has failed , may anyone suggest me what I can do to restore my losses and resume my work.
I am not sure if you have Linux or Windows. First I would check if the npm folder is in path.
You can follow one of these two to add to path if it is not done yet.
Windows
Linux
Alternatively you can install node with node version manager (nvm):
nvm linux and mac
nvm windows

Create-React-App requires Node 4.0 or higher - on Windows

I installed NodeJs LTS v8.11.3 for windows.
Then in cmd I wrote npm -g install create-react-app but I gave a an error that I need Node 4 or higher.
When I run node --v, I have got 0.12.2.
I didn't find how can I change it on windows. I already tried uninstall and restart computer, clean the cache, check windows path if nodeJs is here...
After that, still the same error:
*You are running Node 0.12.2.
Create React App requires Node 4 or higher.
Please update your version of Node.*
What should I do more? Thanks for ideas.
I have moved from 0.8 to 0.10, using the .msi package, overwriting the one installed on my system. Package problems were all fixed with npm update -g. Worked like a charm.
In case it does not work like a charm:
npm cache clean usually fixes the problem. Once the cache is empty, just run npm update -g again.
Ok, I solved it by these steps:
Clean cache from cmd.
Uninstall nodeJs from Program and Features.
Remove folder nodeJs from PATH variable.
Remove nondeleted folder nodeJs from ProgramFiles (here still were some files(?!)).
Restart Computer and after that install nodeJs from website.
After instalation - Restart Computer again.
Run cmd and checked by node -version.
Thanks for your time.

npm-cli.js not found with the CLI command (in Windows 8.1 OS) npm -v

I am trying to install nodejs and npm in my computer with Windows 8.1 - 64 bit. I downloaded the msi from the official nodejs web site and installed it. When I tried to check the version of node by typing node -v, it worked perfectly. But when I tried to check whether npm is installed properly by typing npm -v, the following error appears.
How to fix this.Can someone help me in this. I referred the answers of similar questions here. And this also.But it did not worked too.
This is could because of incorrect installation. Have you tried reinstallation of Node and NPM? If not, uninstall from Program and Features and follow this walkthrough.
Also, need to set npm as global variable $PATH.

Uninstall npm without using npm - is it possible?

I was manually updating node and npm. I am using them from Visual Studio only. Typing any npm command e.g.
npm --version
causes the process to hang and CPU consumption goes max. So I cannot uninstall or reinstall npm with npm commands. Node seems to work fine. I am using Node version 6.3.1 and it responds normally to
node --version
Calling
where node
gives only one result.
What I have done so far:
Upgraded Node.js outside VS2015 using command prompt.
Uninstalled Node together with npm from command prompt.
Deleted Node program folder and all subfolders
Uninstalled Visual Studio 2015
Installed VS 2017 RC.
Even after this last step, the behavior of npm is the same - it hangs. Visual Studio refuses to build at all.
I hope my problems will be solved when npm starts to work again. So I figure next to try is to uninstall npm alone followed by a reinstall. How can I do that without using npm?
Use the following process:
Delete %appdata%\npm and %appdata%\npm-cache.
Edit your PATH and remove everything that references npm (to do so, hit "Start" and search for env).
Reinstall Node, then install this tool - and only use this tool to upgrade npm, do not attempt to run npm install npm.
References
Microsoft NodeJS Guidelines

Unable to install Cordova with npm

Installing Cordova with Nodejs, i got this error :
npm WARN installMany normalize-package-data was bundled with npm#1.3.4, but bund
led package wasn't found in unpacked tree.
The error comes after the command npm install -g cordova
What can be the solution please ?
Thnx
I have solved this issue, so i present here what i did to solve it for anyone who may have the same problem :
I thought about reinstalling Nodejs. So i removed it and installed it again but nothing worked, then i took an installation directory of Nodejs in another computer (which works fine) and copied it to my computer and referenced it in the path environnement variable and every thing worked fine !!
The problem is with cordova and the version of the node.js. The latest version for Node.js (as of today for windows) is problematic with cordova. I went back a few versions and Node-v0-10-36-stable is working fine so far. Other versions may also work but I can only speak for v0.10.36.
http://blog.nodejs.org/2015/01/26/node-v0-10-36-stable/

Resources