error in using packages installed via npm with -g

Asked

Viewed 9,406 times

1

installed npm install typescript -g and npm install @angular/cli -g and I don’t have access to tsc and ng.

'ng' não é reconhecido como um comando interno
ou externo, um programa operável ou um arquivo em lotes.

'tsc' não é reconhecido como um comando interno
ou externo, um programa operável ou um arquivo em lotes.

the files ng.cmd and tsc.cmd are inside this folder

C:\Users\myUserName\AppData\Roaming\npm

environment variables Path

C:\Program Files\nodejs

C:\Users\myUserName\AppData\Roaming\nvm

NODE_PATH:

C:\Users\myUserName\AppData\Roaming\npm\node_modules

NVM_HOME:

C:\Users\myUserName\AppData\Roaming\nvm

NVM_SYMLINK:

C:\Program Files\nodejs

folder of the installed Node:

C:\Program Files\nodejs

windows 10 Home

Ode: V8.10.0

npm: 5.6.0

Solution

Thanks to everyone who responded, after a few tweaks I’m done being able to correct.

The name of the varial Path for PATH.

Then add the path C:\Users\USUARIO\AppData\Roaming\npm.

I restarted and ran the Tsc and ng commands again

  • What error you gave in the installation ?

  • during the installation did not give error, the error in the execution of the commands tsc and ng

  • Started restarting the machine after installation ?

  • I’ve already restarted until I tried to reinstall

2 answers

3

In Windows, add in the environment variables, adding in the PATH variable the value below:

%AppData%\npm;

Save, close the terminal cmd or cmder or Powershell, and try to run the command ng again.

You may have to log in to Windows again.

Inform if it worked.

0

Are you using standard Windows CMD or Power Shell? Sometimes use Cmder or even git bash solves... or maybe use the VS Code.

  • I already tested CMD, Power Shell, git bash and Vscode terminal and still continued with this problem

Browser other questions tagged

You are not signed in. Login or sign up in order to post.