我将NodeJS应用程序部署到Heroku时收到构建失败错误。这是构建日志:
- - - - >检测到Node.js应用 ----->创建运行时环境
NPM_CONFIG_LOGLEVEL=error NODE_VERBOSE=false NODE_ENV=production NODE_MODULES_CACHE=true
- - - - >安装二进制文件 engines.node(package.json):8.10.0 engines.npm(package.json):5.7.1
Resolving node version 8.10.0... Downloading and installing node 8.10.0... Bootstrapping npm 5.7.1 (replacing 5.6.0)... npm 5.7.1 installed
- - - - >恢复缓存 从cacheDirectories加载2(默认): - node_modules - bower_components(未缓存 - 跳过) ----->构建依赖项 安装节点模块(package.json + package-lock) 错误的ERR! path / tmp / build_39ba38c4a10780e26942fa5ee7294cd5 / node_modules / fsevents / node_modules / abbrev 错误的ERR!代码ENOENT 错误的ERR! errno -2 错误的ERR!系统调用重命名 错误的ERR! enoent ENOENT:没有这样的文件或目录,重命名'/ tmp / build_39ba38c4a10780e26942fa5ee7294cd5 / node_modules / fsevents / node_modules / abbrev' - > '/tmp/build_39ba38c4a10780e26942fa5ee7294cd5/node_modules/fsevents/node_modules/.abbrev.DELETE' 错误的ERR! enoent这与npm无法找到文件有关。 错误的ERR! ENOENT
npm ERR! A complete log of this run can be found in: npm ERR! /tmp/npmcache.X6IAU/_logs/2018-03-24T03_18_22_202Z-debug.log
- - - - >构建失败
We're sorry this build is failing! You can troubleshoot common issues here: https://devcenter.heroku.com/articles/troubleshooting-node-deploys If you're stuck, please submit a ticket so we can help: https://help.heroku.com/ Love, Heroku ! Push rejected, failed to compile Node.js app. ! Push failed
我删除了我的node_modules文件夹并运行了npm install并删除/安装了缩写npm包。在此之后仍然是同样的错误。
这是我的package.json:
{
"name": "test",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"dev": "nodemon bin/dev",
"clean": "rm -rf dist",
"build": "npm run clean && mkdir dist && babel server -s -d dist",
"production": "npm run build && nodemon bin/production"
},
"keywords": [],
"author": "",
"devDependencies": {
"dotenv": "^4.0.0"
},
"dependencies": {
"async": "^2.6.0",
"babel-cli": "^6.26.0",
"babel-polyfill": "^6.26.0",
"babel-preset-env": "^1.6.1",
"bcrypt-nodejs": "0.0.3",
"body-parser": "^1.18.2",
"boom": "^7.2.0",
"compression": "^1.7.2",
"cron": "^1.3.0",
"express": "^4.16.3",
"express-rate-limit": "^2.11.0",
"express-validator": "^3.2.1",
"flat": "^4.0.0",
"generate-password": "^1.4.0",
"helmet": "^3.12.0",
"jsonwebtoken": "^7.4.3",
"moment": "^2.21.0",
"moment-timezone": "^0.5.14",
"mongoose": "^4.13.12",
"morgan": "^1.9.0",
"nodemon": "^1.17.2",
"passport": "^0.3.2",
"passport-jwt": "^2.2.1",
"passport-local": "^1.0.0",
"sendgrid": "^5.2.3",
"twilio": "^3.13.1",
"uuid": "^3.2.1"
},
"engines": {
"node": "8.10.0",
"npm": "5.7.1"
}
}
任何建议都表示赞赏。谢谢。