angular-cli icon indicating copy to clipboard operation
angular-cli copied to clipboard

The program 'ng' is currently not installed. sudo apt install ng-common ?

Open Extarys opened this issue 9 years ago • 10 comments

Bug Report or Feature Request (mark with an x)

- [x] bug report -> please search issues before submitting

Versions.

node --version node v8.5.0 npm --version npm 5.3.0

cat /proc/version Linux version 4.11.0-14-generic (buildd@lcy01-08) (gcc version 5.4.0 20160609 (Ubuntu 5.4.0-6ubuntu1~16.04.4) ) #20~16.04.1-Ubuntu SMP Wed Aug 9 09:06:22 UTC 2017 lsb_release -a Distributor ID: LinuxMint Description: Linux Mint 18.2 Sonya Release: 18.2 Codename: sonya

Repro steps.

sudo npm install -g @angular/cli or npm install -g @angular/cli

and then ng --help

gives me

$ ng --help
The program 'ng' is currently not installed. You can install it by typing:
sudo apt install ng-common

Desired functionality.

Should use the angular ng cli program

Mention any other details that might be useful.

No idea what's wrong. all other packages works fine.

Extarys avatar Sep 19 '17 06:09 Extarys

I am using nodenv to manage my node versions. When I type ng this comes out:

$ ng
nodenv: ng: command not found

The `ng' command exists in these Node versions:
  4.2.3

Eralph avatar Oct 06 '17 11:10 Eralph

Hey there,you have met the dependencies for angular-cli but accessing ng over terminal requires you to set the path for global packages in your path environment.

Path known

  • Assuming you have a global modules set up for npm (by default ~/.node_modules_global) $ npm prefix -g

  • Now set the path of modules/bin to our bash path environment to access over terminal

$ echo -e "export PATH=$(npm prefix -g)/bin:$PATH" >> ~/.bashrc 
$ source ~/.bashrc

How about setting a new one!

$ mkdir ~/path/module
$ npm config set prefix '~/path/module'
$ sudo chown -R $USER <directory>

Now the final touch, install angular/cli package npm install -g @angular/cli

#8545 , solution here too. Recent issue follow, if issue persists

guhan62 avatar Nov 19 '17 20:11 guhan62

Hi, I am trying to follow the steps to install @angular/cli

I am having trouble with mkdir ~/path/module, I have run it in two steps: mkdir ~/path and then mkdir ~/path/module or I get a warning. (In the end the folders are created so I guess it's ok)

Then, this line sudo chown -R $USER <directory> produces this error: "-bash: syntax error near unexpected token `newline'"

Am I to replace <directory> with something?

I tryed running sudo chown -R $USER . from "~/path/module"

Also I was getting a warning about "npm WARN [email protected] requires a peer of ajv@^6.0.0 but none was installed."

So I ran apt install ajv and apt install ajv-keywords

Now when I try ng -v I get: --> ng --version ~/path/module/lib/node_modules/@angular/cli/models/config/config.js:17 constructor(_configPath, schema, configJson, fallbacks = []) { ^

SyntaxError: Unexpected token = at exports.runInThisContext (vm.js:53:16) at Module._compile (module.js:374:25) at Object.Module._extensions..js (module.js:417:10) at Module.load (module.js:344:32) at Function.Module._load (module.js:301:12) at Module.require (module.js:354:17) at require (internal/module.js:12:17) at Object. (/home/admin_linux/path/module/lib/node_modules/@angular/cli/models/config.js:3:18) at Module._compile (module.js:410:26) at Object.Module._extensions..js (module.js:417:10) <--

I'm not sure what to try next.

matuqam avatar Feb 21 '18 17:02 matuqam

@matuqam, hey! The directory is replaced with '~/path/module'. Seems like you managed with the permissions part for the npm. Did the warning appear after running, npm install -g @angular/cli ? Are you on the latest npm manager? Seems to messed up at the config level; you could try a fresh install removing npm, modules and setup the environment again all running the latest compatible versions.

Do comment if you have further issues!

guhan62 avatar Feb 21 '18 18:02 guhan62

I'm having the same issue. What's strange is the command used to work. Then I come back to Angular after a few months of using it and all of a sudden it doesn't work.

Linux Mint 17.3, Node 9.5.0, NPM 5.6.0

matthewboman avatar Mar 11 '18 16:03 matthewboman

I am using linux 16 lte. I am getting the same issue.

ndhanorkar avatar Jun 22 '18 13:06 ndhanorkar

I solved it by "sudo npm install --unsafe-perm -g @angular/cli" but i got one error that it can not delete /usr/bin/ng file so i rename it and then execute above command . finally i got success. I am using ubuntu 16.04

Thanks

ndhanorkar avatar Jun 22 '18 13:06 ndhanorkar

I'm sorry, but this issue is not caused by Angular CLI as It looks like an environment issue.

alan-agius4 avatar Jan 08 '19 06:01 alan-agius4

yes, i had a similar issue, and fixed it by doing the following: first : open ~/.profile using and add the following lines:

#NodeJS export NODEJS_HOME=/usr/local/lib/nodejs/node-v11.9.0/bin export PATH=$NODEJS_HOME:$PATH

and then refresh the file by running it like so : . ~/.profile

then everything should be working fine.

muhammadkorra avatar Feb 06 '19 09:02 muhammadkorra

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.