我最近对我要部署的项目进行了更新。它曾经成功构建,但是现在遇到以下错误消息。我不确定是什么错误,因为我已经尝试删除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.
package.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"
}
}
答案 0 :(得分:0)
不确定100%,但是问题出在heroku-prebuild
上,您在其中调用next build
。此时,尚未安装任何依赖项。您应该在另一个阶段运行next build
。您已经将其作为start
脚本。