Heroku React 应用构建失败(node-sass)
Heroku react app build failed (node-sass)
- 上一个版本运行正常,此版本中只有 UI 更改。
- 我只更换了我正在使用的设备,所以可能我忘记下载了一些东西。
- 我不知道为什么这不起作用。
- 无论如何我都没能解决这个问题
"node-sass": "^5.0.0",
构建日志的第一部分:
-----> Building on the Heroku-20 stack
-----> Using buildpack: mars/create-react-app
-----> React.js (create-react-app) multi app detected
=====> Downloading Buildpack: https://github.com/heroku/heroku-buildpack-multi.git
=====> Detected Framework: Multipack
=====> Downloading Buildpack: https://github.com/heroku/heroku-buildpack-nodejs.git
=====> Detected Framework: Node.js
-----> Creating runtime environment
NPM_CONFIG_LOGLEVEL=error
NODE_VERBOSE=false
NODE_ENV=production
NODE_MODULES_CACHE=true
-----> Installing binaries
engines.node (package.json): >=10
engines.npm (package.json): >=6
Resolving node version >=10...
Downloading and installing node 16.0.0...
Bootstrapping npm >=6 (replacing 7.10.0)...
npm >=6 installed
-----> Installing dependencies
Installing node modules
npm ERR! code 1
npm ERR! path /tmp/build_a9056f2a/node_modules/node-sass
npm ERR! command failed
npm ERR! command sh -c node scripts/build.js
npm ERR! Building: /tmp/build_a9056f2a/.heroku/node/bin/node /tmp/build_a9056f2a/node_modules/node-gyp/bin/node-gyp.js
解决方案:
node-sass的节点版本支持策略:
https://www.npmjs.com/package/node-sass
- 上一个版本运行正常,此版本中只有 UI 更改。
- 我只更换了我正在使用的设备,所以可能我忘记下载了一些东西。
- 我不知道为什么这不起作用。
- 无论如何我都没能解决这个问题
"node-sass": "^5.0.0",
构建日志的第一部分:
-----> Building on the Heroku-20 stack
-----> Using buildpack: mars/create-react-app
-----> React.js (create-react-app) multi app detected
=====> Downloading Buildpack: https://github.com/heroku/heroku-buildpack-multi.git
=====> Detected Framework: Multipack
=====> Downloading Buildpack: https://github.com/heroku/heroku-buildpack-nodejs.git
=====> Detected Framework: Node.js
-----> Creating runtime environment
NPM_CONFIG_LOGLEVEL=error
NODE_VERBOSE=false
NODE_ENV=production
NODE_MODULES_CACHE=true
-----> Installing binaries
engines.node (package.json): >=10
engines.npm (package.json): >=6
Resolving node version >=10...
Downloading and installing node 16.0.0...
Bootstrapping npm >=6 (replacing 7.10.0)...
npm >=6 installed
-----> Installing dependencies
Installing node modules
npm ERR! code 1
npm ERR! path /tmp/build_a9056f2a/node_modules/node-sass
npm ERR! command failed
npm ERR! command sh -c node scripts/build.js
npm ERR! Building: /tmp/build_a9056f2a/.heroku/node/bin/node /tmp/build_a9056f2a/node_modules/node-gyp/bin/node-gyp.js
解决方案:
node-sass的节点版本支持策略: https://www.npmjs.com/package/node-sass