我无法使用@angular/cli
ng new
命令
每次我运行ng new PROJECT_NAME
时,它都会给我这个错误
npm ERR! path D:\angular\project\node_modules\@angular-devkit\build-optimizer\node_modules\typescript
npm ERR! code ENOENT
npm ERR! errno -4058
npm ERR! syscall rename
npm ERR! enoent ENOENT: no such file or directory, rename 'D:\angular\project\node_modules\@angular-devkit\build-optimizer\node_modules\typescript' -> 'D:\angular\project\node_modules\@angular-devkit\build-optimizer\node_modules\.typescript.DELETE'
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\denny\AppData\Roaming\npm-cache\_logs\2018-03-27T13_31_25_837Z-debug.log
Error: Package install failed, see above.
Package install failed, see above.
Version :
-Node: v9.8.0
-npm: v5.6.0
-Angular CLI: v1.7.3
我已经尝试了npm uninstall -g @angular/cli
,npm cache clean --force
和npm install -g @angular/cli
,但它仍然无效..请帮助我们......谢谢!
EDITTED:
我甚至清除卸载所有node.js
并重新安装v8.10.0
的LTS版本,它仍然给我同样的错误..当我在'fail-created-中运行ng -v
时项目',它给了我这个:
PS D:\angular\first-project> ng -v
_ _ ____ _ ___
/ \ _ __ __ _ _ _| | __ _ _ __ / ___| | |_ _|
/ △ \ | '_ \ / _` | | | | |/ _` | '__| | | | | | |
/ ___ \| | | | (_| | |_| | | (_| | | | |___| |___ | |
/_/ \_\_| |_|\__, |\__,_|_|\__,_|_| \____|_____|___|
|___/
Angular CLI: 1.7.3
Node: 8.10.0
OS: win32 x64
Angular: error
... animations, cli, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router
@angular-devkit/build-optimizer: error
typescript: error
webpack: error
答案 0 :(得分:1)
我过去也遇到过同样的问题。你应该运行npm install @angular-devkit --save-dev
。它将解决问题。