首页 > 解决方案 > 在 Ubuntu 中使用 npm install 安装 Angular 项目依赖项时遇到错误

问题描述

我安装了 Angular cli 7.3.8 版,使用 npm 链接进行了相同的链接。然后试着去做npm install

这会导致错误:

npm ERR! code ENOENT
npm ERR! syscall open
npm ERR! path /home/usr/mkl/node_modules/@angular-devkit/core/node_modules/fast-json-stable-stringify/package.json.2754642779
npm ERR! errno -2
npm ERR! enoent ENOENT: no such file or directory, open '/home/usr/mkl/node_modules/@angular-devkit/core/node_modules/fast-json-stable-stringify/package.json.2754642779'
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!     /home/usr/.npm/_logs/2020-09-30T14_28_47_932Z-debug.log

我尝试了多种方法来解决这个问题,即node_modules再次删除并尝试 npm install 等等,但无济于事。

npm 版本是6.14.6

角度版本是:

Angular CLI: 7.3.8
Node: 12.18.3
OS: linux x64
Angular: 8.0.3
... animations, common, compiler, compiler-cli, core, forms
... language-service, platform-browser, platform-browser-dynamic
... router

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.13.8 (cli-only)
@angular-devkit/build-angular     0.1001.3
@angular-devkit/build-optimizer   0.803.29
@angular-devkit/core              7.3.8 (cli-only)
@angular-devkit/schematics        7.3.8 (cli-only)
@angular/cli                      7.3.8
@angular/http                     7.2.16
@schematics/angular               7.3.8 (cli-only)
@schematics/update                0.13.8 (cli-only)
rxjs                              6.6.3
typescript                        3.4.5
webpack                           4.39.2

标签: angularnpm

解决方案


我刚刚从 to 切换npmyarn并且能够安装所有依赖项而没有任何问题。

我将在此处发布此内容,以防出现更好的答案。


推荐阅读