[英]Heroku deploy - An unhandled exception occurred: Cannot find module '@angular-devkit/build-angular/package.json'
My project runs perfectly on my local machine, but getting this error when trying to deploy live to Heroku:我的项目在我的本地机器上运行完美,但在尝试实时部署到 Heroku 时出现此错误:
I am getting the error: An unhandled exception occurred: Cannot find module '@angular-devkit/build-angular/package.json'我收到错误:发生未处理的异常:找不到模块“@angular-devkit/build-angular/package.json”
I have updated my Heroku engines to match my local machine as well:我已经更新了我的 Heroku 引擎以匹配我的本地机器:
"engines": {
"node": "12.16.2",
"npm": "6.14.4"
}
This is sitting in my dev dependencies:这是坐在我的开发依赖:
"@angular-devkit/build-angular": "^0.901.1"
Here is the full Heroku log --tail errors:这是完整的 Heroku 日志 --tail 错误:
admin-platform@0.0.0 start /app
ng serve
An unhandled exception occurred: Cannot find module '@angular-devkit/build-angular/package.json'
Require stack:
/app/node_modules/@angular/cli/node_modules/@angular-devkit/architect/node/node-modules-architect-host.js
/app/node_modules/@angular/cli/node_modules/@angular-devkit/architect/node/index.js
/app/node_modules/@angular/cli/models/architect-command.js
/app/node_modules/@angular/cli/commands/serve-impl.js
/app/node_modules/@angular-devkit/schematics/tools/export-ref.js
/app/node_modules/@angular-devkit/schematics/tools/index.js
/app/node_modules/@angular/cli/utilities/json-schema.js
/app/node_modules/@angular/cli/models/command-runner.js
/app/node_modules/@angular/cli/lib/cli/index.js
/app/node_modules/@angular/cli/lib/init.js
/app/node_modules/@angular/cli/bin/ng
Thank you in advance!先感谢您!
Just copy "@angular-devkit/build-angular": "^0.901.1" from devDependencies to dependencies in your package.json file.只需将 "@angular-devkit/build-angular": "^0.901.1" 从 devDependencies 复制到 package.json 文件中的依赖项。 Had the same problem few minutes ago.
几分钟前遇到了同样的问题。
"dependencies": {
"@angular-devkit/build-angular": "^0.901.1",
...
}
Be sure to change your start script to "node server.js" or the name of your server file, for further troubleshooting, here is a guide on how to deploy an angular app to heroku https://medium.com/@ryanchenkie_40935/angular-cli-deployment-host-your-angular-2-app-on-heroku-3f266f13f352请务必将启动脚本更改为“node server.js”或服务器文件的名称,以便进一步排除故障,这是有关如何将 angular 应用程序部署到 heroku https://medium.com/@ryanchenkie_40935/的指南angular-cli-deployment-host-your-angular-2-app-on-heroku-3f266f13f352
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.