0

I am creating a sample angular2 web app. For that i have installed node.js (v 7.1.0)and NPM (v 3.10.9). and now after opening system command prompt when I execute the command : NPM install -g @angular/cli to install angular cli I am getting the following shown results. After doing ng -v to check the version of cli installed I am not getting the version number.

Is the cli not installed correctly? or do I need to set any path variable in environment var? What has to be done here? Please advise.

C:\Users\27727>d:

D:\>cd learn-angular

D:\learn-angular>npm i -g @angular/cli
npm WARN gentlyRm not removing C:\Users\27727\AppData\Roaming\npm\ng.cmd as it w
asn't installed by C:\Users\27727\AppData\Roaming\npm\node_modules\@angular\cli
npm WARN gentlyRm not removing C:\Users\27727\AppData\Roaming\npm\ng as it wasn'
t installed by C:\Users\27727\AppData\Roaming\npm\node_modules\@angular\cli
C:\Users\27727\AppData\Roaming\npm\ng -> C:\Users\27727\AppData\Roaming\npm\node
_modules\@angular\cli\bin\ng
C:\Users\27727\AppData\Roaming\npm
`-- @angular/cli@1.7.0

npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.0.0 (node_modules\@a
ngular\cli\node_modules\chokidar\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@
1.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"}
)
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.0.0 (node_modules\@a
ngular\cli\node_modules\webpack-dev-server\node_modules\chokidar\node_modules\fs
events):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@
1.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"}
)
npm WARN ajv-keywords@3.1.0 requires a peer of ajv@^6.0.0 but none was installed
.

D:\learn-angular>ng -v
'ng' is not recognized as an internal or external command,
operable program or batch file.

D:\learn-angular>
Rahul Sharma
  • 9,534
  • 1
  • 15
  • 37
  • Did you try to reopen your console? Just the first idea that comes in my mind. – Kapcash Feb 20 '18 at 10:19
  • Please refer this https://stackoverflow.com/questions/37991556/ng-is-not-recognized-as-an-internal-or-external-command – Rakesh A R Feb 20 '18 at 10:24
  • @Kapcash i reopened and tried but the same again...i also tried in Node.js command prompt ...but the ng -v doesnt work. so either the cli is not installed correctly or there some other issue – Rashmi Sharma Feb 20 '18 at 10:26
  • @RakeshAR i referred to that post earlier... but the error in my case is different. – Rashmi Sharma Feb 20 '18 at 10:29
  • Could you check the module is installed in the global node_module folder? "C:\Users\You\AppData\Roaming\npm\node_modules" :) – Kapcash Feb 20 '18 at 10:30
  • @Kapcash the \AppData\Roaming\npm\node_modules has angular-cli and "@angular" folders – Rashmi Sharma Feb 20 '18 at 10:40

1 Answers1

0

In your system please check this path ( C:\Program Files\nodejs ) is there in environment variables.

Jithin Raj P R
  • 6,667
  • 8
  • 38
  • 69
Rakesh A R
  • 186
  • 1
  • 2
  • 17
  • I would suggest once remove node JS and install it again – Rakesh A R Feb 20 '18 at 10:39
  • C:\Program Files\nodejs is already present in system path shown below : \;C:\Program Files (x86)\WebEx\Productivity Tools;C: \Program Files\nodejs\;C:\Program Files\Git\cmd;C:\Program Files\CA\SC\CAWIN\;C: \WINDOWS\system32; – Rashmi Sharma Feb 20 '18 at 10:43
  • C:\Users\YOUR USER NAME\AppData\Roaming\npm add this path to environment variable – Rakesh A R Feb 20 '18 at 11:03