Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

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 command,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 command,operable program or batch file.
3.10.9

Windows 10

Thanks So Much In Advance

@DanielA.White Like here exactly : blog.teamtreehouse.com/install-node-js-npm-windows When i finished installing node js there was an error "warning 1909 could not create shortcut node.js command prompt.lnk" – Aly Magdy Feb 16, 2017 at 16:39

I 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 command 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.

Either is fine with me, Alejandro. I wish for others who are struggling with this issue to see the additional symptoms I was observing. – toberi Oct 31, 2017 at 14:40

Firstly, check using GitBash whether the npm -v command 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.

Thanks for contributing an answer to Stack Overflow!

  • Please be sure to answer the question. Provide details and share your research!

But avoid

  • Asking for help, clarification, or responding to other answers.
  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.