0

I am a bit confused about the Angular-CLI and its requirements.

I have an existing and running angular project on my system. It is running nicely. I can start the builtin server too with

ng serve

Now I tried to create a new project. Create a directory and do this inside.

ng new MYTEST

But the output gives my an error.

installing ng
  create .editorconfig
  ...
  create tsconfig.json
  create tslint.json
Installing packages for tooling via npm.
/bin/sh: 1: npm: not found

Package install failed, see above.
/usr/local/lib/node_modules/@angular/cli/tasks/npm-install.js:25
                    throw new Error(message);
                    ^

Files and directories were created but then npm is not found. But is is installed and latest (Debian 10, npm is a virtual package for nodejs 6.14.3-1nodesource1).

I find

/usr/local/bin/npm -> ../lib/node_modules/npm/bin/npm-cli.js

How can I get rid of that problem? Thanks!

EDIT

> node -v
v8.0.0

> npm -v
bash: npm: command not found
4
  • what is the output of npm --version Commented Jul 20, 2018 at 8:34
  • npm as a binary is not found. You see in my post that is is pointing to a npm-cli.js Commented Jul 20, 2018 at 8:39
  • Did you intsall npm globally ? Commented Jul 20, 2018 at 8:40
  • 1
    Your install seems broken, your /bin/sh doesn't find npm command. To manage npm different version I'm using github.com/creationix/nvm on Ubuntu and macOS. There are many reasons why your npm install could be broken so...you should just reinstall it properly. Commented Jul 20, 2018 at 8:54

1 Answer 1

2
  1. Check versions

    node -v
    npm -v

  2. Reinstall NodeJS

    sudo apt-get remove --purge nodejs npm
    curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -
    sudo apt-get install -y nodejs

  3. Check versions again.

  4. Angualar CLI must be installed globally

    npm i -g @angular/cli

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

7 Comments

4 is actually false
Yes and no. Theoretically you can use workarounds like github.com/angular/angular-cli/issues/… but its easier to use globally. Unless there is a reason to use different CLI versions on a system
Is there a good reason why not use the nodejs from the linux distro?
If I do so then npm is still not installed. nodejs is v8.11.2
I use Ubuntu and its repositoryis version of nodejs has no Package Manager, so you have to install is separately. But I experienced incompatible issues a couple of times. It's easier to use nodejs repository itself
|

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.