【发布时间】:2022-02-15 00:27:43
【问题描述】:
我正在尝试使用 npm install 为运行 Angular 11 的小项目安装所需的 node_modules
我的目标是让项目从 GitHub 下载后在本地运行。我已经安装了最新版本的 Angular CLI。
运行安装命令后,我尝试了npm start。
我期待在运行安装和启动命令后能够在本地运行项目。 但是,我在运行 install 命令后得到的实际结果是以下错误列表:
> ng serve
An unhandled exception occurred: Cannot find module '@angular/compiler'
Require stack:
\node_modules\@angular\compiler-cli\index.js
\node_modules\@ngtools\webpack\src\angular_compiler_plugin.js
\node_modules\@ngtools\webpack\src\index.js
\node_modules\@angular-devkit\build-angular\src\webpack\configs\typescript.js
\node_modules\@angular-devkit\build-angular\src\webpack\configs\index.js
\node_modules\@angular-devkit\build-angular\src\browser\index.js
\node_modules\@angular-devkit\build-angular\src\dev-server\index.js
\node_modules\@angular-devkit\architect\node\node-modules-architect-host.js
\node_modules\@angular-devkit\architect\node\index.js
\node_modules\@angular\cli\models\architect-command.js
\node_modules\@angular\cli\commands\serve-impl.js
\node_modules\@angular-devkit\schematics\tools\export-ref.js
\node_modules\@angular-devkit\schematics\tools\index.js
\node_modules\@angular\cli\utilities\json-schema.js
\node_modules\@angular\cli\models\command-runner.js
\node_modules\@angular\cli\lib\cli\index.js
\node_modules\@angular\cli\lib\init.js
\node_modules\@angular\cli\bin\ng
See "angular-errors.log" for further details.
npm ERR! code ELIFECYCLE
npm ERR! syscall spawn
npm ERR! file C:\WINDOWS\system32\cmd.exe
npm ERR! errno ENOENT
npm ERR! `ng serve`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the @0.0.16 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
问题是这个 Angular 项目也有对等依赖。我安装了npm-install-peers 包,但似乎之后简单地运行npm install 不会安装所需的对等依赖项。
接下来我应该怎么做才能在本地安装这个 Angular 项目?
【问题讨论】:
标签: node.js angular npm dependencies