Angular-cli: Failed to create angular app via cli

Created on 18 Jan 2017  ·  8Comments  ·  Source: angular/angular-cli

Please provide us with the following information:

OS?

Windows 7, 8 or 10. Linux (which distribution). Mac OSX (Yosemite? El Capitan?)
Linux, Linux Mint 18 Sarah

Versions.

Please run ng --version. If there's nothing outputted, please run in a Terminal: node --version and paste the result here:
ng --version
bash: /usr/bin/ng: No such file or directory

node --version
v4.2.6

Repro steps.

Was this an app that wasn't created using the CLI? What change did you do on your code? etc.
I can't create angular app

The log given by the failure.

Normally this include a stack trace and some more information.

Mention any other details that might be useful.

I try create angular but I get error
ng new first-app
bash: /usr/bin/ng: No such file or directory

I tried fix it via
$ sudo ln -s /usr/bin/nodejs /usr/bin/node
ln: failed to create symbolic link '/usr/bin/node': File exists
but this doesn't work

I would be happy get any help how to solve this problem.


Thanks! We'll be in touch soon.d

Most helpful comment

@vitalizis you can add to path of system, export PATH="$PATH:$HOME/npm/bin". To changes work better add this export in your ~/.bashrc

All 8 comments

@vitalizis it looks like angular-cli is not installed globally.

Please refer to this section of the README: https://github.com/angular/angular-cli#installation

I intsalled angular-cli as globally,

npm list -g --depth=0
/home/vitaliz/npm/lib
├── [email protected]
├── [email protected]

So, now when I try install angular app I get next:
$ ng new angular-2
The program 'ng' is currently not installed. You can install it by typing:
sudo apt install ng-common

If I install ng-common (that propose me in terminal) and try create app I get next:
ng new angular-2
/usr/bin/ng: line 40: exec: new: not found

I'm glad get still advice how to fix it.

ng-common is a linux package for Nihongo MicroGnuEmacs, so that's not what you want.

It looks like your npm modules are installed in /home/vitaliz/npm/lib which is non-standard. Please make sure to add the bin folder of the global node_modules to your path .

@vitalizis Exactly how did you install node.js ?
Exactly how did you install angular-cli ?

I solved that problem next: creating symbolic link like this
sudo ln -s /home/vitaliz/npm/lib/node_modules/angular-cli/bin/ng /usr/bin
but I'm not sure that it works for all global packege may be exist more common solution
@catull
1) I reinstall node.js. so just via sudo apt-get install npm
2)via sudo npm install -g angular-cli like on tutorial

@vitalizis you can add to path of system, export PATH="$PATH:$HOME/npm/bin". To changes work better add this export in your ~/.bashrc

@vitaliz
Hi,
I think the problem with your node version, try to set specific version expected for your angular-cli.
Using this: nvm use Version [Eg: nvm use 8.11.1]

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

_This action has been performed automatically by a bot._

Was this page helpful?
0 / 5 - 0 ratings