Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
Extarys opened this issue Sep 19, 2017 · 10 comments
Closed

Comments

@Extarys
Copy link

Extarys commented Sep 19, 2017

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-6ubuntu116.04.4) ) #2016.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.

@Eralph
Copy link

Eralph commented Oct 6, 2017

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

@guhan62
Copy link

guhan62 commented Nov 19, 2017

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

@hansl hansl removed their assignment Feb 6, 2018
@matuqam
Copy link

matuqam commented Feb 21, 2018

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 ajv-keywords@3.1.0 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.

@guhan62
Copy link

guhan62 commented Feb 21, 2018

@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!

@matthewboman
Copy link

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

@ndhanorkar
Copy link

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

@ndhanorkar
Copy link

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

@alan-agius4
Copy link
Collaborator

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

@muhammadkorra
Copy link

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.

@angular-automatic-lock-bot
Copy link

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.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 9, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants