Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/node.js/33.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/heroku/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Node.js Heroku没有创建巴别塔';s输出目录作为构建过程的一部分_Node.js_Heroku_Build_Babeljs - Fatal编程技术网

Node.js Heroku没有创建巴别塔';s输出目录作为构建过程的一部分

Node.js Heroku没有创建巴别塔';s输出目录作为构建过程的一部分,node.js,heroku,build,babeljs,Node.js,Heroku,Build,Babeljs,第一次尝试将Node.js/Babel项目部署到Heroku。我已经读过了,但仍然得到了与heroku日志--tail中显示的相同错误: 020-09-29T16:56:02.668214+00:00 heroku[web.1]:使用命令启动进程 2020-09-29T16:56:05.602838+00:00 heroku[web.1]:进程退出,状态为1 2020-09-29T16:56:05.647609+00:00 heroku[web.1]:状态从开始更改为崩溃 2020-09-29T

第一次尝试将Node.js/Babel项目部署到Heroku。我已经读过了,但仍然得到了与heroku日志--tail中显示的相同错误:

020-09-29T16:56:02.668214+00:00 heroku[web.1]:使用命令启动进程 2020-09-29T16:56:05.602838+00:00 heroku[web.1]:进程退出,状态为1
2020-09-29T16:56:05.647609+00:00 heroku[web.1]:状态从开始更改为崩溃
2020-09-29T16:33:23.754299+00:00应用程序[网站1]:>应用程序-name@1.0.0启动应用程序
2020-09-29T16:33:23.754300+00:00应用程序[web.1]:>babel index.js-d构建和节点构建/index.js
2020-09-29T16:33:23.904863+00:00应用程序[web.1]:内部/modules/cjs/loader.js:968
2020-09-29T16:33:23.904865+00:00应用程序[web.1]:抛出错误
2020-09-29T16:33:23.904866+00:00应用程序[web.1]:^
2020-09-29T16:33:23.904867+00:00应用程序[web.1]:错误:找不到模块“/app/build/index.js”

package.json的片段

{
  "main": "index.js", //also tried with build/index.js
  "scripts": {
    "heroku-postbuild": "npm install",
    "start": "babel index.js -d build & node build/index.js"
  },
  "dependencies": {
    "@babel/core": "^7.11.6",
    "@babel/cli": "^7.11.6",
    "@babel/preset-env": "^7.11.5",
    "@babel/polyfill": "^7.11.5",
    "axios": "^0.20.0",
    "dotenv": "^8.2.0",
    "express": "^4.17.1"
  },
  "devDependencies": {
    "babel-watch": "^7.0.0",
    "make-runnable": "^1.3.8"
  },
  "engines": {
    "node": "12.*"
  }
}
Procfile

web: npm run start
“heroku postbuild”:“npm安装”
安装依赖项,因此按照Procfile中的说明运行
start
脚本时,可以在heroku中使用Babel

babel index.js-d build
应该在app文件夹中创建一个build文件夹,
node build/index.js
应该在所述build文件夹中执行编译后的index.js

从错误日志(以及本文标题)可以看出,
babel index.js-d build
根本没有运行,因为没有消息表明babel编译了任何东西,Heroku服务器的应用程序中也没有build文件夹,我通过
Heroku run bash
检查了该文件夹

我注意到,如果我在本地构建源代码,然后提交构建文件夹,它工作得很好,但是,这是正确的方法吗

谢谢你的帮助

谢谢