4

i am getting error, The system cannot find the path specified. when adding test new project into node.js command prompt getting error. I am totally confused to create new project.

Your environment has been set up for using Node.js 12.14.1 (x64) and npm.

C:\Users\user>npm install -g @angular/cli
C:\Users\user\AppData\Roaming\npm\ng -> C:\Users\user\AppData\Roaming\npm\node_m
odules\@angular\cli\bin\ng

> @angular/[email protected] postinstall C:\Users\user\AppData\Roaming\npm\node_modules
\@angular\cli
> node ./bin/postinstall/script.js

+ @angular/[email protected]
updated 1 package in 59.885s

C:\Users\user>ng new test
The system cannot find the path specified.

I am using operating system window 8.1 pro version In my system below variables added

1) User variables for user

NODE_PATH: C:\Users\user\AppData\Roaming\npm\node_modules

Path:C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Windows Kits\8.1\Windows Performance Toolkit\;C:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\;C:\Program Files\Microsoft SQL Server\100\Tools\Binn\;C:\Program Files\Microsoft SQL Server\100\DTS\Binn\;C:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\VSShell\Common7\IDE\;C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE\PrivateAssemblies\;C:\Program Files (x86)\Microsoft SQL Server\100\DTS\Binn\;C:\Program Files\Microsoft\Web Platform Installer\;%USERPROFILE%.dnx\bin;C:\Program Files\Microsoft DNX\Dnvm\;C:\Program Files\Microsoft SQL Server\120\Tools\Binn\;%AppData%\npm;;C:\Program Files (x86)\Microsoft VS Code\bin;%AppData%\npm;C:\Program Files\nodejs\;C:\Users\user\AppData\Roaming\npm

2) System variables

Path:%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SYSTEMROOT%\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Windows Kits\8.1\Windows Performance Toolkit\;C:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\;C:\Program Files\Microsoft SQL Server\100\Tools\Binn\;C:\Program Files\Microsoft SQL Server\100\DTS\Binn\;C:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\VSShell\Common7\IDE\;C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE\PrivateAssemblies\;C:\Program Files (x86)\Microsoft SQL Server\100\DTS\Binn\;C:\Program Files\Microsoft\Web Platform Installer\;%USERPROFILE%.dnx\bin;C:\Program Files\Microsoft DNX\Dnvm\;C:\Program Files\Microsoft SQL Server\120\Tools\Binn\;%AppData%\npm

Mr doubt
  • 51
  • 1
  • 10
  • 42

4 Answers4

0

Try to run the following commands:

  1. npm install -g npm@latest
  2. npm config set script-shell bash

After that, run the ng new command again.

  • I tried your two command after that i did: C:\Users\user>ng -v 'ng' is not recognized as an internal or external command, operable program or batch file. @Brontosaurs – Mr doubt Feb 07 '20 at 19:07
  • i did not use run as administrator, normally open command promt. @Quethzel – Mr doubt Feb 08 '20 at 07:56
0

Just want to rule out the possibility of Path corruption. Please try the following:

rem for future
setx NODE_PATH %AppData%\npm\node_modules
rem for current session
set NODE_PATH=%AppData%\npm\node_modules
setx path "%path%;%AppData%\npm"
ng -v

Modified version to the original answer: https://stackoverflow.com/a/9588052/639107

kn_pavan
  • 1,510
  • 3
  • 21
  • 42
  • I tried all your commands : C:\Users\user>setx NODE_PATH %AppData%\npm\node_modules SUCCESS: Specified value was saved. C:\Users\user>set NODE_PATH=%AppData%\npm\node_modules C:\Users\user>setx path "%path%;%AppData%\npm" SUCCESS: Specified value was saved. C:\Users\user>ng -v 'ng' is not recognized as an internal or external command, operable program or batch file. @kn_pavan – Mr doubt Feb 07 '20 at 19:21
  • If nothing helps. I would rather suggest clean-up everything and install Node through `nvm` for windows. – kn_pavan Feb 10 '20 at 06:56
0

Not sure if you are actually creating a project called test.

At least until 8.0 it was impossible to create a project with the name test. You'd get some warning about an invalid project name. Try to create another project with another name. cli-test for example.

Robin Dijkhof
  • 18,665
  • 11
  • 65
  • 116
0

If nothing works then have a fresh setup. unintsall node and all then install everything you need. make sure abouth PATH

TheRakeshPurohit
  • 551
  • 1
  • 6
  • 22