简体   繁体   中英

Angular-CLI: npm missing

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM