2

It happens that when I install angular cli, it gets stuck at this point

I have looked for any solution , install/uninstall node.js and tried to use different versions of node and npm with no success.

EDIT: After uninstalling node.js, erasing npm folder in appdata, and reinstalling again, it installs but it does not recognize the ng command as shown here

6
  • can you install any other package?
    – William B
    Commented May 1, 2017 at 19:56
  • Yes I can, now I'm trying to delete the npm and npm cache folder. It might work... now the problem is that the deleting lasts a lot
    – Jn Sk
    Commented May 1, 2017 at 20:04
  • Now it installs but it doesn't recognize the ng command, going to edit the post for this.
    – Jn Sk
    Commented May 1, 2017 at 21:04
  • 1
    The last time you didn't pass the --global (-g) option.
    – user5085788
    Commented May 1, 2017 at 21:37
  • Please paste text instead of pointing us to pictures.
    – user663031
    Commented May 2, 2017 at 3:11

4 Answers 4

1

It seems it is a path issue. This solution helped me fix it on macOs High Sierra.

  • npm install -g @angular/cli

  • Make sure the ng path is correct

  • cd ~/npm-global/bin

  • ls and make sure ng exists
  • create .bashrc file on your home directory

  • touch ~/.bashrc

  • vim ~/.bashrc
  • Add ng as alias

  • press i (enables edit mode) then type in the following

  • alias ng="~/npm-global/bin/ng" (or wherever your ng directory is)
  • press esc (to get out of edit mode) then :wq (in vim will save)
  • Temporarily Update .bashrc reference
  • Your terminal wont take bash updates until a restart but the following command will let you use the updates during the terminal session:

  • source ~/.bashrc Check that ng works

ng --version

Found it from https://github.com/angular/angular-cli/issues/5021

1
  • Npm version : 5.6.0, Node version :8.11.1, Angular CLI: 6.0.7 Commented May 30, 2018 at 17:37
0

May be try using ng commands with node.js cli (Node.js command prompt). It might work. I'd the same problem Here.

0

It happens that your node.js and angular visions are not compatible.

After the install and remove all the node files from on your pc. then try these commands.

  1. Install node.js package manager stable version.
  2. After the install you run npm install
  3. npm install -g @angular/cli 04 ng new <project name>
  4. cd <your project location>
  5. ng serve
    (If it's still not working, again npm install and ng serve)

If this is still not working, provide a sample of the .json file in your question.

0

I had to add npm to the Path user variable:

  1. Open Settings > System > About > Advanced system settings
  2. Environment Variables...
  3. User variables for... > Path
  4. Add "%USERPROFILE%\AppData\Roaming\npm"

Not the answer you're looking for? Browse other questions tagged or ask your own question.