问题
Error while running: npm install -g angular-cli
C:\Windows\System32>node -v
v7.5.0
C:\Windows\System32>npm -v
4.1.2
C:\Users\Chiranjeevi>npm -v minimatch
4.1.2
-------------------------------------------------------------------------------------------
C:\Users\Chiranjeevi>npm install -g angular-cli
npm WARN deprecated minimatch@2.0.10: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
C:\Users\Chiranjeevi\AppData\Roaming\npm
`-- (empty)
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.0.0 (node_modules\angular-cli\node_modules\chokidar\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.0.17: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN @angular/core@2.4.6 requires a peer of rxjs@^5.0.1 but none was installed.
npm ERR! Windows_NT 10.0.14393
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "-g" "angular-cli"
npm ERR! node v7.5.0
npm ERR! npm v4.1.2
npm ERR! path C:\Users\Chiranjeevi\AppData\Roaming\npm\node_modules\.staging\yallist-2cab1649\package.json.797219503
npm ERR! code ENOENT
npm ERR! errno -4058
npm ERR! syscall rename
npm ERR! enoent ENOENT: no such file or directory, rename 'C:\Users\Chiranjeevi\AppData\Roaming\npm\node_modules\.staging\yallist-2cab1649\package.json.797219503' -> 'C:\Users\Chiranjeevi\AppData\Roaming\npm\node_modules\.staging\yallist-2cab1649\package.json'
npm ERR! enoent ENOENT: no such file or directory, rename 'C:\Users\Chiranjeevi\AppData\Roaming\npm\node_modules\.staging\yallist-2cab1649\package.json.797219503' -> 'C:\Users\Chiranjeevi\AppData\Roaming\npm\node_modules\.staging\yallist-2cab1649\package.json'
npm ERR! enoent This is most likely not a problem with npm itself
npm ERR! enoent and is related to npm not being able to find a file.
npm ERR! enoent
npm ERR! Please include the following file with any support request:
npm ERR! C:\Users\Chiranjeevi\npm-debug.log
回答1:
You should execute npm cache clean
instead of npm clear cache
(see https://docs.npmjs.com/cli/cache).
Regarding npm WARN @angular/core@2.4.6 requires a peer of rxjs@^5.0.1 but none was installed.
: There is an open angular cli issue concerning rxjs. As a workaraound, you can execute npm install -g rxjs
.
Additionally, the npm package name for angular cli changed from angular-cli to @angular-cli.
That is, the following might help:
npm uninstall -g angular-cli
npm cache clean
npm install -g rxjs
npm install -g @angular/cli
回答2:
Try to run npm clear cache
and than npm install -g angular-cli
回答3:
Make sure you have latest Nodejs(LTS version) installed. Try following
- npm i npm -g
- npm cache clean
- npm install -g @angular/cli
来源:https://stackoverflow.com/questions/42046121/error-npm-install-g-angular-cli-npm-err-windows-nt-10-0-10586