0
votes

I am new to npm and Angular 2, I am trying to setup a new Angular 2 project using angular/cli.

I am currently running:

Node v8.9.3 npm v5.6.0 Windows 10

First, I ran npm install -g @angular/cli which seemed to install just fine. Then I went to the folder where I wanted to start my project, ran ng new my-app but kept getting this error.

npm WARN deprecated [email protected]: angular-cli has been renamed to @angular/cli. Please update your dependencies.

npm WARN deprecated [email protected]: ReDoS vulnerability parsing Set-Cookie https://nodesecurity.io/advisories/130

npm WARN deprecated [email protected]: Use uuid module instead

npm WARN deprecated [email protected]: please upgrade to graceful-fs 4 for compatibility with current and future versions of Node.js

npm WARN deprecated [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue

npm WARN deprecated [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue

npm WARN deprecated [email protected]: please upgrade to graceful-fs 4 for compatibility with current and future versions of Node.js

npm WARN [email protected] requires a peer of @angular/compiler@^2.3.1 || >=4.0.0-beta <5.0.0 but none is installed. You must install peer dependencies yourself.

npm WARN [email protected] requires a peer of @angular/core@^2.3.1 ||

=4.0.0-beta <5.0.0 but none is installed. You must install peer dependencies yourself.

npm WARN @ngtools/[email protected] requires a peer of webpack@^2.2.0 || ^3.0.0 but none is installed. You must install peer dependencies yourself.

npm WARN [email protected] requires a peer of webpack@^2.2.0 but none is installed. You must install peer dependencies yourself.

npm WARN [email protected] requires a peer of webpack@1 || 2 || 3 but none is installed. You must install peer dependencies yourself.

npm WARN [email protected] requires a peer of tslint@^3.0.0 but none is installed. You must install peer dependencies yourself.

npm WARN [email protected] requires a peer of webpack@^1.0.0 || ^2.0.0 || ^3.0.0 but none is installed. You must install peer dependencies yourself.

npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules\fsevents):

npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})

npm ERR! path C:\Web Development\Projects\angular 2 practice\my-app\node_modules\@angular-cli\ast-tools\node_modules\mkdirp\bin\cmd.js

npm ERR! code ENOENT

npm ERR! errno -4058

npm ERR! syscall chmod

npm ERR! enoent ENOENT: no such file or directory, chmod 'C:\Web Development\Projects\angular 2 practice\my-app\node_modules\@angular-cli\ast-tools\node_modules\mkdirp\bin\cmd.js'

npm ERR! enoent This is related to npm not being able to find a file.

npm ERR! enoent

npm ERR! A complete log of this run can be found in:

npm ERR! C:\Users\Jason Kervin\AppData\Roaming\npm-cache_logs\2017-12-12T00_57_54_496Z-debug.log

Package install failed, see above.

4

4 Answers

2
votes

Try these steps:

  1. npm cache clean --force
  2. Open cmd and go to your current user cd C:\Users{your user name here}
  3. npm config set registry http://registry.npmjs.org/
  4. npm install -g npm@latest
  5. npm install -g @angular/cli
1
votes

From the command line run

ng -v

This should output 1.6.0. If it doesn't you have an older version of the CLI installed.

Run:

npm cache --force clean

And then:

npm install @angular/cli -g

If that doesnt work remove the folders in C:\Users\<username>\AppData\Roaming

0
votes

Use these lines:

npm cache clean --force

npm install -g @angular/cli@latest
0
votes

After lots of research on this I came to a final solution, I tried lots of solutions but not worked for me. Try this it works for me, I'm using Ubuntu.

Uninstall angular cli.

Hit following command,

sudo npm uninstall -g angular-cli

check version if version still present, check path

which ng

It will give following output

/usr/bin/ng

Now delete this by using

sudo rm -rf /usr/bin/ng

then remove angular package

sudo rm -rf /usr/lib/node_modules/@angular

Now your angular cli is completely removed from your machine.

Now check angulars latest stable version and install it.

if problem is still present than uninstall node and delete global node_modules folder.

sudo apt-get purge nodejs

sudo apt-get autoremove

sudo rm -rf /usr/lib/node_modules

And install node and angular again.

And try to create new project. Hope it will work for you. Thank You!