我正在尝试部署一个由我自己的webpack配置组成的react应用(不是Create-react-app)。我可以在本地成功构建应用程序并在本地成功运行。但是当我推送到Heroku时,git push heroku master
会收到以下消息:
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Node.js app detected
remote:
remote: -----> Creating runtime environment
remote:
remote: NPM_CONFIG_LOGLEVEL=error
remote: NPM_CONFIG_PRODUCTION=true
remote: YARN_PRODUCTION=true
remote: NODE_ENV=production
remote: NODE_MODULES_CACHE=false
remote: NODE_VERBOSE=false
remote:
remote: -----> Installing binaries
remote: engines.node (package.json): 10.x
remote: engines.npm (package.json): unspecified (use default)
remote: engines.yarn (package.json): 1.x
remote:
remote: Resolving node version 10.x...
remote: Downloading and installing node 10.16.0...
remote: Using default npm version: 6.9.0
remote: Resolving yarn version 1.x...
remote: Downloading and installing yarn (1.16.0)...
remote: Installed yarn 1.16.0
remote:
remote: -----> Restoring cache
remote: Caching has been disabled because NODE_MODULES_CACHE=false
remote:
remote: -----> Installing dependencies
remote: Installing node modules (yarn.lock)
remote: yarn install v1.16.0
remote: [1/4] Resolving packages...
remote: [2/4] Fetching packages...
remote: info fsevents@1.2.9: The platform "linux" is incompatible with this module.
remote: info "fsevents@1.2.9" is an optional dependency and failed compatibility check. Excluding it from installation.
remote: [3/4] Linking dependencies...
remote: [4/4] Building fresh packages...
remote: Done in 18.83s.
remote:
remote: -----> Build
remote: Running build (yarn)
remote: yarn run v1.16.0
remote: $ rm -rf build/ && webpack --env.mode production
remote:
remote: Insufficient number of arguments or no entry found.
remote: Alternatively, run 'webpack(-cli) --help' for usage info.
remote:
remote: Hash: 9809f658cd5ff48864d7
remote: Version: webpack 4.33.0
remote: Time: 555ms
remote: Built at: 06/12/2019 9:16:13 PM
remote:
remote: ERROR in Entry module not found: Error: Can't resolve 'babel-loader' in '/tmp/build_429e145805178d81754292048e646eab'
remote: Child html-webpack-plugin for "index.html":
remote: 1 asset
remote: Entrypoint undefined = index.html
remote: [0] ./node_modules/html-webpack-plugin/lib/loader.js!./public/index.html 1.9 KiB {0} [built]
remote: [2] (webpack)/buildin/global.js 472 bytes {0} [built]
remote: [3] (webpack)/buildin/module.js 497 bytes {0} [built]
remote: + 1 hidden module
remote: error Command failed with exit code 2.
remote: info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
remote:
remote: -----> Build failed
remote:
remote: We're sorry this build is failing! You can troubleshoot common issues here:
remote: https://devcenter.heroku.com/articles/troubleshooting-node-deploys
remote:
remote: If you're stuck, please submit a ticket so we can help:
remote: https://help.heroku.com/
remote:
remote: Love,
remote: Heroku
remote:
remote: ! Push rejected, failed to compile Node.js app.
remote:
remote: ! Push failed
remote: Verifying deploy...
remote:
remote: ! Push rejected to react-go-fullstack.
remote:
这是我的package.json:
{
"name": "fullstack-course",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"start": "rm -rf build/ && webpack-dev-server --env.mode development --hot",
"build": "rm -rf build/ && webpack --env.mode production"
},
"engines": {
"node": "10.x",
"yarn": "1.x"
},
"repository": {
"type": "git"
},
"author": "",
"license": "ISC",
"bugs": {
"url": "https://github.com/NaseebullahSafi/fullstack-course/issues"
},
"devDependencies": {
"@babel/cli": "^7.2.3",
"@babel/core": "^7.4.0",
"@babel/preset-env": "^7.4.2",
"@babel/preset-react": "^7.0.0",
"babel-loader": "^8.0.6",
"babel-plugin-styled-components": "^1.10.0",
"clean-webpack-plugin": "^2.0.1",
"css-loader": "^2.1.1",
"style-loader": "^0.23.1"
},
"dependencies": {
"copy-webpack-plugin": "^5.0.3",
"html-webpack-plugin": "^3.2.0",
"mini-css-extract-plugin": "^0.7.0",
"optimize-css-assets-webpack-plugin": "^5.0.1",
"prop-types": "^15.7.2",
"react": "^16.8.5",
"react-dom": "^16.8.6",
"react-hot-loader": "^4.8.0",
"react-redux": "^6.0.1",
"redux": "^4.0.1",
"redux-thunk": "^2.3.0",
"resources-manifest-webpack-plugin": "^3.0.0",
"styled-components": "^4.2.0",
"webpack": "^4.29.6",
"webpack-cli": "^3.3.4",
"webpack-dev-server": "^3.2.1",
"webpack-merge": "^4.2.1"
}
}
有人可以解释这个问题是什么,如何解决这个问题。
谢谢