简体   繁体   English

发生未处理的异常:找不到模块 '@angular-devkit/build-angular/package.json' 需要堆栈:

[英]An unhandled exception occurred: Cannot find module '@angular-devkit/build-angular/package.json' Require stack:

I have been assigned a task where I have to run ng serve command in folder.我被分配了一个任务,我必须在文件夹中运行 ng serve 命令。

I have installed node.js and checked it's version.我已经安装了 node.js 并检查了它的版本。 Run this command npm install -g @angular/core @angular/cli运行这个命令 npm install -g @angular/core @angular/cli

I have following folder structure.我有以下文件夹结构。

ProjectFolder - > ClientApp - >Src
                            -> dist
                            -> e2e

I am running this command inside ProjectFolder and I am getting this error.The serve Command requires to be angular project but project definition could not found.我在 ProjectFolder 中运行此命令,但出现此错误。 serve 命令需要是 angular 项目,但找不到项目定义。

Is my path is wrong?是我的路径不对吗? In which folder shall I run this command ?我应该在哪个文件夹中运行这个命令? ClientApp or Src? ClientApp 还是 Src?

If I make new project and serve this ng serve,it is working.如果我创建新项目并提供此 ng 服务,则它正在工作。

So I tried to run project inside ClientApp所以我尝试在 ClientApp 中运行项目

When I am running ng serve inside clientApp,getting msg :An unhandled exception occurred:当我在 clientApp 中运行 ng serve 时,收到 msg :发生未处理的异常:

Cannot find module找不到模块

'@angular-devkit/build-angular/package.json' Require stack: .

So many error like AppData\Roaming\npm\node_modules\@angular\cli\models\architect-command.js

\AppData\Roaming\npm\node_modules\@angular\cli\utilities\json-schema.js

AppData\Roaming\npm\node_modules\@angular\cli\lib\init.js

AppData\Roaming\npm\node_modules\@angular\cli\bin\ng

I have taken my project from live devops directory.我从 live devops 目录中获取了我的项目。

It don't have node_modules folder in project.它在项目中没有 node_modules 文件夹。

Do that folder is necessary?那个文件夹是必要的吗?

Do I need run npm install command?我需要运行 npm install 命令吗?

Inside which folder?ClientApp?在哪个文件夹内?ClientApp?

Yes, you will need to install node modules inside ClientApp folder.是的,您需要在 ClientApp 文件夹中安装节点模块。 Please make sure that you have package.json file is present inside the ClientApp folder.请确保您有 package.json 文件存在于 ClientApp 文件夹中。

Use below command inside the ClientApp folder to install node modules:在 ClientApp 文件夹中使用以下命令安装节点模块:

npm i

You need this add angular to existing project as I doubt if your project is an angular project.您需要将此添加到现有项目中,因为我怀疑您的项目是否是一个有角度的项目。 If it is not, refer to this link.如果不是,请参阅此链接。

Else, you may add another reference from your error solving by c-sharpcorner否则,您可以通过 c-sharpcorner从您的错误解决中添加另一个参考

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 我收到此错误:发生未处理的异常:找不到模块'@angular-devkit/build-angular/package.json' 需要堆栈: - I get this error: An unhandled exception occurred: Cannot find module '@angular-devkit/build-angular/package.json' Require stack: Heroku 部署 - 发生未处理的异常:找不到模块“@angular-devkit/build-angular/package.json” - Heroku deploy - An unhandled exception occurred: Cannot find module '@angular-devkit/build-angular/package.json' 角度错误:未处理的异常:找不到模块@angular-devkit/build-angular/package.json - angular-error: unhandled exception: cannot find module @angular-devkit/build-angular/package.json 错误:找不到模块'@angular-devkit/build-angular/package.json' - Error: Cannot find module '@angular-devkit/build-angular/package.json' 发生未处理的异常:找不到模块“@angular-devkit/build-angular” - An unhandled exception occurred: Could not find module "@angular-devkit/build-angular" 发生未处理的异常:找不到模块“@angular-devkit/build-angular”从“/project 到 docker - An unhandled exception occurred: Could not find module “@angular-devkit/build-angular” from "/project into a docker 尝试在 Angular 项目中运行 ng serve 时出现问题'找不到模块“@angular-devkit/build-angular/package.json'” - Problem trying to run ng serve in Angular Project 'Cannot find module “@angular-devkit/build-angular/package.json' ” 在 docker-compose 期间找不到模块 @angular-devkit/build-angular/package.json - Cannot find module @angular-devkit/build-angular/package.json during docker-compose up 发生未处理的异常:找不到 builder @angular-devkit/build-angular:dev-server 的实现 - An unhandled exception occurred: Could not find the implementation for builder @angular-devkit/build-angular:dev-server 发生未处理的异常:无法从“/ang-frontend”找到模块“@angular-devkit/build-angular”。 使用 docker 和 docker-compose - An unhandled exception occurred: Could not find module "@angular-devkit/build-angular" from "/ang-frontend". with docker and docker-compose
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM