1

When I execute ng -v it shows:

bash: /usr/local/lib/node_modules/@angular/cli/bin/ng: No such file or directory.

I tried doing the solution in bash /usr/bin/ng: No such file or directory in Angular but could not find node_modules folder in /usr/local/lib folder. Even after running sudo npm install @angular/[email protected], I get the same error.

Any help please

1
  • run the following command sudo npm i -g @angular/[email protected] Commented Aug 14, 2018 at 16:09

3 Answers 3

1

I've been experienced the exact same error previously. In my case, it was caused by running this command in the wrong place that has unnecessary package.json and package-lock.json in an outdated format.

Please double check if you are executing ng -v in the correct path, and both package.json and package-lock.json are updated in the correct states.

Sign up to request clarification or add additional context in comments.

Comments

1

I was able to solve it. Just for info if any one is willing to know

1) npm uninstall -g angular-cli
2) npm cache clean --force
3) sudo npm install -g @angular/[email protected]
4) added line 'alias ng="/home/XXXXXX/.npm-global/lib/node_modules/@angular/cli/bin/ng"' in ~/.bashrc

Created a new terminal and checked ng -v and it worked.

I want to create a pwa app so i hope cli 6.2 should work fine

Comments

1

You need to install the package globally

sudo npm i -g @angular/[email protected]

2 Comments

When i run this command , it says "npm ERR! enoent ENOENT: no such file or directory, open '/home/{MYNAME}/package.json'". This error is caused i think because we are using 'run' in command
run is used to run scripts from package.json

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.