将NodeJS应用程序部署到Heroku崩溃,并出现"权限被拒绝"错误



我的postinstall脚本将TypeScript编译为dist。它在部署后按预期工作,我可以看到里面的编译文件。但在部署(web: dist/main.js(后,我在日志中有这个:

Starting process with command `dist/main.js` Process exited with status 126 State changed from starting to crashed bash: dist/main.js: Permission denied

为什么Buildpack des没有访问权限?

您正在尝试执行命令dist/main.js,而不是尝试使用node运行它。

使用这个替代:

node dist/main.js