I have been trying insall node js and install browser sync
C:\Users\Aly>npm install -g browser-sync
'CALL "C:\Program Files (x86)\nodejs\\node.exe" "C:\Program Files `(x86)\nodejs\\`
node_modules\npm\bin\npm-cli.js" prefix -g' is not recognized as an internal or external mand,operable program or batch file.
Even if i want to know my node js version , the same error appear and then the version shown after that
C:\Users\Aly>npm --version
'CALL "C:\Program Files (x86)\nodejs\\node.exe" "C:\Program Files `(x86)\nodejs\\`
node_modules\npm\bin\npm-cli.js" prefix -g' is not recognized as an internal or external mand,operable program or batch file.
3.10.9
Windows 10
Thanks So Much In Advance
I have been trying insall node js and install browser sync
C:\Users\Aly>npm install -g browser-sync
'CALL "C:\Program Files (x86)\nodejs\\node.exe" "C:\Program Files `(x86)\nodejs\\`
node_modules\npm\bin\npm-cli.js" prefix -g' is not recognized as an internal or external mand,operable program or batch file.
Even if i want to know my node js version , the same error appear and then the version shown after that
C:\Users\Aly>npm --version
'CALL "C:\Program Files (x86)\nodejs\\node.exe" "C:\Program Files `(x86)\nodejs\\`
node_modules\npm\bin\npm-cli.js" prefix -g' is not recognized as an internal or external mand,operable program or batch file.
3.10.9
Windows 10
Thanks So Much In Advance
Share Improve this question asked Feb 16, 2017 at 15:39 Aly MagdyAly Magdy 272 gold badges3 silver badges8 bronze badges 3- 2 how did you install node? – Daniel A. White Commented Feb 16, 2017 at 15:40
-
1
why there's \\ before
node.exe
? you must've installed nodejs incorrectly. – m87 Commented Feb 16, 2017 at 15:43 - @DanielA.White Like here exactly : blog.teamtreehouse./install-node-js-npm-windows When i finished installing node js there was an error "warning 1909 could not create shortcut node.js mand prompt.lnk" – Aly Magdy Commented Feb 16, 2017 at 16:39
3 Answers
Reset to default 2I just spend way to long with this issue. I'm not sure how it got set, perhaps during an install, but I changed a System Variable:
Name: ComSpec Value: %SystemRoot%\system32\cmd.exe;prefix=C:\Program Files (x86)\nodejs\node.exe
To this:
Name: ComSpec Value: %SystemRoot%\system32\cmd.exe
And restarted my system and the issue was gone.
Good catch blur0224.
I also spent way too long on this issue reinstalling node
in various ways and investigating administrator privileges
for the %appdata%/roaming/npm -folder
.
Your solution worked for me also. The ComSpec variable
contained old trash (referring to uninstalled programs) which somehow interfered when calling npm.
Side note 1: What was REALLY confusing was that calling npm worked for many npm package retrievals, but not all. Error code in the failed cases would for me contain keywords such as code ELIFECYCLE
and errno ENOENT
.
Side note 2: I also received warning 1909 could not create shortcut node.js mand prompt.lnk
when installing node - perhaps implying that an environmental variable was not properly installed.
Anyone seeing the symptoms from the two previous paragraphs could try the answer from blur0224. I hope this helps people searching for these keywords.
Firstly, check using GitBash whether the npm -v
mand executes successfully.
If NPM is working in GitBash, then it is not a path problem (your path reference is OK).
Go to Environment Variables > System Variables and check if ComSpec: %SystemRoot%\system32\cmd.exe
is correctly configured, or not.
In some cases, if you have a trailing slash, it will not work. (eg: ComSpec : %SystemRoot%\system32\cmd.exe\
) If so, simple remove the trailing slash.
Otherwise, check where cmd.exe
is located and use that path as the ComSpec
value.
Usually, it resides at c://Windows/System32/cmd.exe
.