heroku - Heroku 构建失败:heroku-prebuild
问题描述
我最近对我正在尝试部署的项目进行了更新。它之前构建成功,但现在遇到以下错误消息。我不确定错误是什么,因为我已经尝试删除 package-lock.json,清除 npm 缓存并重新安装 npm。提前致谢!
-----> Node.js app detected
-----> Creating runtime environment
NPM_CONFIG_LOGLEVEL=error
NODE_ENV=production
NODE_MODULES_CACHE=true
NODE_VERBOSE=false
-----> Installing binaries
engines.node (package.json): unspecified
engines.npm (package.json): unspecified (use default)
Resolving node version 8.x...
Downloading and installing node 8.12.0...
Using default npm version: 6.4.1
-----> Building dependencies
Running heroku-prebuild
> kickstart@1.0.0 heroku-prebuild /tmp/build_ddb0ffb55870b12204585dc338aab661
> next build
sh: 1: next: not found
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! kickstart@1.0.0 heroku-prebuild: `next build`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the kickstart@1.0.0 heroku-prebuild script.
包.json
{
"name": "kickstart",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"heroku-prebuild": "next build",
"test": "mocha",
"dev": "node server.js",
"start": "next build"
},
"author": "",
"license": "ISC",
"dependencies": {
"fs-extra": "^5.0.0",
"ganache-cli": "^6.1.0",
"mocha": "^4.1.0",
"next": "^4.2.3",
"next-routes": "^1.3.0",
"react": "^16.2.0",
"react-dom": "^16.2.0",
"semantic-ui-css": "^2.3.0",
"semantic-ui-react": "^0.77.2",
"solc": "^0.4.21",
"truffle-hdwallet-provider": "0.0.3",
"web3": "1.0.0-beta.26"
},
"devDependencies": {
"eslint-config-airbnb": "^16.1.0",
"eslint-plugin-import": "^2.9.0",
"eslint-plugin-jsx-a11y": "^6.0.3",
"eslint-plugin-react": "^7.7.0"
}
}
解决方案
不是 100% 确定,但问题出heroku-prebuild
在你打电话的地方next build
。此时,尚未安装任何依赖项。你应该next build
在不同的阶段运行。您已经将其作为start
脚本。
推荐阅读
- java-8 - Java8获取数据并保存在hashmap中,性能问题
- ios - 这两个调度队列有什么区别?
- sqlite - 从 SQLITE 数据库 kotlin 检索日期明智的数据
- azure-api-management - 使用 Azure APIM 进行相互证书身份验证
- node.js - 不能将 React.lazy 与 Material UI 图标一起使用
- groovy - Soap UI:Groovy 测试步骤:如何从另一个 Groovy 脚本调用 groovy 脚本中的特定方法
- java - 在 jsp 中使用 c:foreach 时如何修复错误 NumberFormatException
- java - Android:Gradle 编译错误期望元素值是一个常量表达式 - 功能模块
- jenkins - Jenkinsfile java.lang.NullPointerException:无法调用方法
在空对象上 - scikit-learn - 保存一个 scikit-learn Bunch 对象