Angular-cli: ng - No such file or directory

Created on 11 May 2017  路  12Comments  路  Source: angular/angular-cli

- [ X ] bug report

Versions.

Output from: ng --version: No such file or directory
Output from: node --version: v7.10.0
Output from: npm --version: 4.2.0

macOS Sierra 10.12.4

Repro steps.

After running ng new app on a fresh install of Node.js and npm I am getting the error message: -bash: /Users/Liz/.npm-packages/lib/node_modules/@angular/cli/bin/ng: No such file or directory. How can I fix this error?

Most helpful comment

alias ng="/usr/local/lib/node_modules/@angular/cli/bin/ng"

All 12 comments

to me it seems angular cli is not installed ? have you run npm install -g @angular/cli ?

@dave11mj's comment is on point. Check out https://github.com/angular/angular-cli#installation for install instructions.

I ran that install again and I am getting a new error. Do you have any idea what could be causing this?

/Users/Liz/.nvm/versions/node/v4.4.0/lib/node_modules/@angular/cli/models/config/config.js:16
constructor(_configPath, schema, configJson, fallbacks = []) {
^

SyntaxError: Unexpected token =
at exports.runInThisContext (vm.js:53:16)
at Module._compile (module.js:373:25)
at Object.Module._extensions..js (module.js:416:10)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
at Module.require (module.js:353:17)
at require (internal/module.js:12:17)
at Object. (/Users/Liz/.nvm/versions/node/v4.4.0/lib/node_modules/@angular/cli/models/config.js:3:18)
at Module._compile (module.js:409:26)
at Object.Module._extensions..js (module.js:416:10)

@erbanach I haven't seen that error before .. but from what I can tell it seems you are using node 4.4.0 and Angular Cli requires at least node 6.9.0.. Try updating your node to the latest version and that should hopefully clear out that error. ^^

I've seen in some cases NVM global installs getting completely messed up. You report Node 7, but that error log shows that stuff is running from node 4. In this case my advice is to uninstall NVM and all your node/npm versions and then reinstall them.

(Windows machine)
Same issue is happening while installing Angular-CLI with
Node - 8.9.4
NPM - 5.6.0

ERROR:

No such file or directory, open C:\Users(UserName)\AppData\Roaming\npm\node_modules.staging\rxjs-8af1cb8d_esm2015\Subscription.js.map'

I have so many similar warning/errors in the terminal.

Now doingng -v gives me "ng" is not recognized as ....

Since I had my ng file located at npm-global changing path did the trick.
alias ng="/home/{USerName}/.npm-global/lib/node_modules/@angular/cli/bin/ng"
ng -v

Angular CLI: 1.7.3
Node: 7.10.1
OS: linux x64
Angular:
...

@micronyks I have same problem as you. Have you figured out a solution yet?

alias ng="/usr/local/lib/node_modules/@angular/cli/bin/ng"

Try this

  1. npm remove -g angular-cli
  2. npm cache clean
  3. npm install -g @angular/cli

This is because of NVM in my case it works fine with this
alias ng="/home/usr_name/.nvm/versions/node/v10.16.0/lib/node_modules/@angular/cli/bin/ng

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

Related issues

sysmat picture sysmat  路  3Comments

naveedahmed1 picture naveedahmed1  路  3Comments

donaldallen picture donaldallen  路  3Comments

JanStureNielsen picture JanStureNielsen  路  3Comments

gotschmarcel picture gotschmarcel  路  3Comments