9

I have a strange error message I don't understand or can't get rid of. Secondly when I try to create express app on webstorm it can't find express. I'm using windows 7 64 bit.

PS C:\dv> npm -v

The system cannot find the path specified.

1.2.14

PS C:\dv>

many thanks in advance

Jeremy

Lokesh Pandey
  • 1,739
  • 23
  • 50
Jeremy Affolter
  • 133
  • 1
  • 1
  • 8

7 Answers7

13

It's a really old post, but I thought I'd share just in case it helps someone. In my case, the issue wasn't with npm, but instead with ansicon.

Removing the value of the registry key HKEY_CURRENT_USER\Software\Microsoft\Command Processor\AutoRun resolved the issue, as described in these links...

https://github.com/cmderdev/cmder/issues/121

The system cannot find the path specified when starting Ruby and Rails command prompt

Community
  • 1
  • 1
racingcow
  • 769
  • 2
  • 9
  • 27
  • Thanks a lot, uninstalling/reinstalling did nothing but this worked for me as well (Windows10) !!! – tsf144 Nov 29 '16 at 04:20
  • Thank you so much! I had installed ConEmu and had later uninstalled it, which was throwing the '..cannot find path..' error. Deleting that fixed it! – Breakpoint Mar 27 '17 at 05:37
  • Answer fixed my issue as well 8/14/2017. No clue where, why or how `ansicon` ended up installed on my machine. – JoeManFoo Aug 14 '17 at 15:08
  • Thanks, similar to others I had once had ConEmu installed. I was having lots of problems with getting npm to run, and removing this registry key was the answer. – Fishwalker Nov 21 '17 at 05:16
  • Thank you a lot, I tried to install clink as command line and followed some steps for installation, this caused the problem. Just removed autorun and it works. – Firas Abd Alrahman Apr 22 '19 at 08:15
  • For me, it was having Anaconda3 installed and then uninstalled. This set the Autorun key but didn't clean it up. – dOxxx Mar 08 '22 at 20:27
10

For me , Deleting these two folder worked:

JUST Delete

C:\Users\yourUserName\AppData\Roaming\npm

AND

C:\Users\yourUserName\AppData\Roaming\npm-cache
Amrit
  • 2,115
  • 1
  • 21
  • 41
3

I spent days figuring out how to fix this. Finally, using Process Monitor program, I found out:

  1. npm was trying to access a file in %APPDATA%/Temp which no longer existed since I had uninstalled that program.
  2. I searched the registry keys for this path and found that this path was included in the *Computer\HKEY_USERS\S-1-5-21-1659004503-1897051121-1177238915-282167\Software\Microsoft\Command Processor\AutoRun* value.
  3. Note that this was not under HKEY_CURRENT_USER registry directory as mentioned in the comments above.
  4. After removing this registry key, everything works now.

Hope this helps.

Rishabh Agarwal
  • 1,988
  • 1
  • 16
  • 33
Farnaz K
  • 31
  • 2
3

In my case, nvm-windows "destroy" my windows setting. https://github.com/coreybutler/nvm-windows

I uninstall nvm-windows than go to AppData (hidden folder sometimes) - change to visible: https://support.microsoft.com/en-us/help/4028316/windows-view-hidden-files-and-folders-in-windows-10 and remove npm cache manually (Under username\AppData\Roaming\npm-cache)

Also, run windows command %temp% Ctrl + A (select all) and delete - to clean up your system (maybe related).

Some of my global -g- packages (Like vue-cli should re-install) - after this weird bug (Nightmare).

Ezra Siton
  • 6,887
  • 2
  • 25
  • 37
1

Had the same problem. Running npm gave me this error:

C:\Users\user>npm
The system cannot find the path specified.

I ended up uninstalling nodejs from the Control Panel and re-installing with a fresh download.

The error doesn't say it couldn't find the command, so I figured it was something wrong with the npm script. The script is located at C:\Program Files\nodejs\npm.cmd, found via the path var. echo %path%.

The script contained:

@IF EXIST "%~dp0\/bin/sh.exe" (
  "%~dp0\/bin/sh.exe"  "%~dp0\node_modules\npm\bin\npm-cli.js" %*
) ELSE (
  /bin/sh  "%~dp0\node_modules\npm\bin\npm-cli.js" %*
)

This looked wrong, as there are forward slashes for Windows and no sh.exe file where the script wants it to be. There is also no /bin/sh file, because its Windows :( Which is why it can't find the specified path.

I tried to get node working in cygwin because its resembles linux and makes Windows at least somewhat bearable. Maybe this was the problem?

Anyway after re-installing the npm.cmd file looks like:

:: Created by npm, please don't edit manually.
@IF EXIST "%~dp0\node.exe" (
  "%~dp0\node.exe" "%~dp0\.\node_modules\npm\bin\npm-cli.js" %*
) ELSE (
  node "%~dp0\.\node_modules\npm\bin\npm-cli.js" %*
)

The slashes look right and it works.

1

Do you use Cygwin or any other Linux emulating shell as your Command Line? If that's the case a possible cause could be a known bug with the npm script. Please try the solution suggested here,

https://stackoverflow.com/a/22436199/2390020

Community
  • 1
  • 1
Tharaka
  • 2,355
  • 1
  • 20
  • 22
0

Issue was with OneDrive on Windows 10 for me. Moving the file outside of OneDrive and onto desktop solved the issue. Kibana was throwing the error for me.

Angus
  • 96
  • 7