I installed node js on windows 7 from https://nodejs.org/en/download/. When I run node -v out put is v8.9.4 But when I check npm -v out put is
The system cannot find the path specified.
5.6.0
In path variable entry is as
C:\Users\<username>\AppData\Roaming\npm
blank npm folder is present on above path
I added entry in path variable as it is recommended in some answer
C:\Program Files\nodejs
but still getting same error. I tried solutions I found online like above path entry, re installation, global installation of npm but still same error
I found a solution in this article: https://www.thetopsites.net/article/53531888.shtml
"I needed to move my node paths further up the list. Windows must have been looking for NPM in the wrong path variable. I moved my node path to the top of the system path variables and now NPM works."
It helped me after a day of struggle.
More details for the solution provided by #Thomas.K:
Open Windows Settings and search for 'environ' like here:
Make sure to choose the one for "system environment", and in the dialog which appears press this button:
You will get this dialog
There are two PATH declarations, at top and bottom. You will have to remove the npm entry off the upper list, and paste it into the top of the lower list. This should solve the problem of "The system cannot find the path specified".
Related
My computer keeps forgetting that I have node installed despite the fact that all of the files are still there. So far, I have tried installing through the node installer on the nodejs website, using brew, using nvm, and also several of the suggestions in this gist. No matter what I try, within a couple of hours or a couple of days, I am working away and then I am suddenly throwing node errors, and when I check node -v or npm -v, I get the error command not found: node or command not found: npm. The only thing that I can figure out to get node working again is to uninstall whatever I most recently tried and then to reinstall.
It seems like I might be having some sort of env or path issue, but I don't know where to begin to start troubleshooting anything like that.
EDIT
Based on the suggestion below, I added these to my .bash_profile and it seems to have fixed my issue. Not sure why the install wasn't adding them here or in .bashrc, but adding it manually fixed the issue:
export PATH="$HOME/.npm-packages/bin:$PATH"
export PATH="$HOME/.node_modules/bin:$PATH"
maybe you forgot to add node & npm binaries to your path that's why when you open a new instance of your terminal it says that it doesn't know node and npm
Simply add the line that register the binaries into your path within your .profile file that might be located in your home directory
I was trying to change my npm and npm-cache folders to d:\\npm-global and d:\\npm-cache
I managed to do a npm config set cache d:\npm-cache
When I tried to do a npm config set prefix d:\npm-global I accidentally put a ' in the folder string as I was hitting enter. I deleted the errant folder after trying a npm i -g gulp and to my horror, npm stopped working altogether, it just sits there with my command prompt rocking up to 50% CPU usage.
Help please! I've tried searching the registry and other places, even uninstalled and re-installed the nodejs msi package on Windows. This reset the D:\Program Files\nodejs\node_modules\npm\npmrc file.
Still no luck. I can't get npm to work again. :(
edit A little digging in and I realized there is a second node server running via Adobe Creative Cloud. I doubt this is the problem though as when I run npm from the cmd.exe prompt, the correct (d:\program files\nodejs) version of the npm server is executed for that process.
edit so only sometimes when I hit Control-C, I'll get this error:
seems like it's trying to find a file that doesn't exist. However, I cleared out the AppData\Roaming\npm folder and the reinstalls reset the default d:\program files\nodejs\....npm\npmrc file. I also made sure that the environment variable NODE_PATH is not set. It wasn't set when it was working. I set it when I was trying to make my changes.
You should be able to modify your config settings manually by modifying ~/.npmrc
#jakemingolla was right so I marked that answer as accepted (thanks Jake), but I also asked this in the NPM forum and did a little test after I got it working. I thought this might help someone: https://npm.community/t/i-killed-my-npm-on-windows-trying-to-move-some-folders-reinstalling-nodejs-isnt-resetting-the-problem/5743/8?u=chi11ax
Windows, VSC, Running npm start got this
npm WARN lifecycle The node binary used for scripts is C:\Program
Files\nodejs\node.exe but npm is using
C:\somewhere\AppData\Roaming\npm\node_modules\node\bin\node.exe
itself. Use the --scripts-prepend-node-path option to include the
path for the node binary npm was executed with.
I understand it means my local version is diff from the one in the PATH variable (C:\Program Files...). How do proceed to tell it to use --scripts-prepend-node-path?
I played a trick by replacing the C:\Program Files\nodejs with C:\somewhere\AppData\Roaming\npm\node_modules\node\bin in PATH variable, it does pick up that new node.exe got but there is no node binary in the current PATH. Again recommend to use the --scrip
ts-prepend-node-path option to include the path for the node binary npm was executed with
Like I said, replacing the actual path in PATH system variable didn't fix the problem completely, it still complained about binary is missing. Found this solved the there is no node binary in the current PATH problem. So I restored the original PATH, then:
Simply create a file at the root folder of the app, called .npmrc,
place this line into it:
scripts-prepend-node-path=true
Here's another way that works: npm config set scripts-prepend-node-path auto
Conflict between your node binary and your npm
In case the error looks something like:
npm is trying to use the same node as the one it use to run itself.
resolve this conflict by adding the node directory to your PATH:
npm config set scripts-prepend-node-path true
From the npm documentation:
npm run sets the NODE environment variable to the node executable with
which npm is executed. Also, if the --scripts-prepend-node-path is
passed, the directory within which node resides is added to the PATH
Having this issue in Visual Studio 2017, I instead told VS to always use the NodeJS that I had installed from nodejs.org rather than the frozen-in-time one that ships with Visual Studio. (The one that shipped with VS2015 is so ancient it doesn't really work anymore.)
In Visual Studio, go to TOOLS > OPTIONS > search for EXTERNAL WEB TOOLS > and ensure "C:\Program Files\nodejs" (or wherever nodejs.org installed it) is first in the list of paths, adding it if necessary.
For WebStorm, invalidating caches and restarting worked for me.
My 'npm' folder is in D:\Box folder because I don't have space on C.
I configure Protractor to work by adding in System Environment Variables new environment variable named PROTRACTOR with value: .
Then in System Path I've entered: %PROTRACTOR%\bin
And this works for Protractor perfectly.
Now I want to add jasmine-reporters and I paste in npm\node_modules\jasmine-node\node_modules 'jasmine-reporters' and 'jasmine-growl-reporter' folders.
Then run one test with jasmine report in conf.js and I see error message:
Cannot find module 'jasmine-reporters'.
What I try:
Paste 'jasmine-reporters' and 'jasmine-growl-reporter' folders in npm\node_modules
Add in System Environment Variables NODE_PATH: D:\Box\npm\node_modules
The result is the same.
Someone, please help me with this issue.
If you want to keep your global node_modules on the D:\ drive you need to change prefix in npm config as described in npm docs
Short version (in command prompt as administrator):
npm config set prefix d:\box
To see what is the current path you can issue:
npm config get prefix
Go to C:\Users\username\AppData\Roaming\npm\node_modules
-Remove jasmine-reporters
Go to C:\Users\username\AppData\Roaming
-Remove npm-Cache
Reinstall jasmine-reporter and npm
Node version 0.10.4 and npm 1.2.18 is installed in windows 64 bit.after that I use
'npm install -g yo' to install yeoman .But yo is not installed in my machine.After installation when I write 'yo --version',then error gives that yo is not recognized as an internal or external command.Please suggest how to install yeoman in windows.
Node seems to be installed in "c:\Program Files\nodejs\" however yo seems to get installed in "c:\Users\\AppData\Roaming\npm\"
If you check this folder there should be a yo.cmd file. If there isn't then you have another issue and this will not fix our problem.
You can use the %APPDATA% variable as well.
You'll have to add this new path to your %PATH% environment variable.
Fix:
Right click "My Computer"
Click on Properties
Click Advanced system settings
click on Advanced tab.
click the Environment Variables... button
find the PATH variable and add to its value %APPDATA%\npm\ (use semicolon ";" to separate what you add from what is already there)
make sure that there are no extra spaces around the semicolon