Javascript 在尝试部署到Heroku时是否缺少Web包依赖项?
我正在尝试将我的项目部署到使用webpack的Heroku。我正在关注如何使用webpack部署我的项目。当我执行git push heroku master时,我收到以下错误:Javascript 在尝试部署到Heroku时是否缺少Web包依赖项?,javascript,reactjs,heroku,webpack,Javascript,Reactjs,Heroku,Webpack,我正在尝试将我的项目部署到使用webpack的Heroku。我正在关注如何使用webpack部署我的项目。当我执行git push heroku master时,我收到以下错误: remote: > webpack -p remote: remote: sh: 1: webpack: not found remote: remote: npm ERR! Linux 3.13.0-105-generic remote:
remote: > webpack -p
remote:
remote: sh: 1: webpack: not found
remote:
remote: npm ERR! Linux 3.13.0-105-generic
remote: npm ERR! argv "/tmp/build_4edddf9818027153c0f2847e8272d33e/.heroku/node/bin/node" "/tmp/build_4edddf9818027153c0f2847e8272d33e/.heroku/node/bin/npm" "install" "--unsafe-perm" "--userconfig" "/tmp/build_4edddf9818027153c0f2847e8272d33e/.npmrc"
remote: npm ERR! node v6.9.5
remote: npm ERR! npm v3.10.10
remote: npm ERR! file sh
remote: npm ERR! code ELIFECYCLE
remote: npm ERR! errno ENOENT
remote: npm ERR! syscall spawn
remote: npm ERR! fire-emblem-quiz@1.0.0 postinstall: `webpack -p`
remote: npm ERR! spawn ENOENT
remote: npm ERR!
remote: npm ERR! Failed at the fire-emblem-quiz@1.0.0 postinstall script 'webpack -p'.
remote: npm ERR! Make sure you have the latest version of node.js and npm installed.
remote: npm ERR! If you do, this is most likely a problem with the fire-emblem-quiz package,
remote: npm ERR! not with npm itself.
remote: npm ERR! Tell the author that this fails on your system:
remote: npm ERR! webpack -p
remote: npm ERR! You can get information on how to open an issue for this project with:
remote: npm ERR! npm bugs fire-emblem-quiz
remote: npm ERR! Or if that isn't available, you can get their info via:
remote: npm ERR! npm owner ls fire-emblem-quiz
remote: npm ERR! There is likely additional logging output above.
remote:
当我看到错误消息时,它说找不到webpack,所以我将它作为依赖项安装在我的项目中。但是,我无法部署我的项目
这是我的网页包配置文件:
module.exports = {
entry: [
'./src/index.js'
],
output: {
path: __dirname,
filename: 'app/js/main.js'
},
module: {
loaders: [{
test: /\.jsx?$/,
loader: 'babel',
exclude: /node_modules/
}]
}
}
这是我的package.json文件:
{
"name": ,
"version": "1.0.0",
"description": ,
"main": "index.js",
"scripts": {
"start": "node ./node_modules/webpack-dev-server/bin/webpack-dev-server.js",
"prod": "NODE_ENV=production node server.js",
"postinstall": "webpack -p"
},
"author": ,
"license": "ISC",
"devDependencies": {
"babel-core": "5.8.*",
"babel-loader": "5.3.*",
"webpack": "^1.14.0"
},
"dependencies": {
"express": "^4.14.1",
"react": "^15.4.2",
"react-dom": "^15.4.2"
}
}
谢谢你的帮助。谢谢。当package.json的devdependences中指定了webpack时,Heroku缺少webpack依赖关系的问题的答案中建议了几种解决方法。
遵循最适合你的方法 请参考Hi。我遵照你的建议,解决了网页错误信息。当我推到heroku时,一切似乎都在成功构建,但我得到了一个无法获取/页面。现在,我收到了一条错误消息:
来自UglifyJs的app/js/main.js中的警告,我不太确定它是否都连接好了。我从devdependences安装了依赖项,但仍然没有安装。在这一点上有什么建议吗?我建议你发布另一个问题,并提供关于你现在面临的问题的完整信息。