heroku rails 构建失败并出现疯狂错误...可能是节点问题?

heroku rails build fails with crazy error... possibly node issue?

我有一个大约一年没有更新的应用程序,今天我做了一个小改动,没有破坏任何东西,但是在推动掌握时我得到了很多东西......作为你会在下面看到。做了一些谷歌搜索,注意到它可能是一个节点版本问题,所以我添加到 heroku buildpack 所以结果是这样的,首先有 heroku/nodejs buildpack 是允许 Heroku 在 packages.json 而不是默认值:

Using buildpacks:
1. heroku/nodejs
2. heroku/ruby

并在 packages.json 中进一步指定版本:

{
  "name": "timely",
  "private": true,
  "dependencies": {
    "@rails/actioncable": "^6.0.0",
    "@rails/activestorage": "^6.0.0",
    "@rails/ujs": "^6.0.0",
    "@rails/webpacker": "4.2.2",
    "jasmine-core": "^3.5.0",
    "jquery": "^3.4.1",
    "turbolinks": "^5.2.0"
  },
  "version": "0.1.0",
  "devDependencies": {
    "webpack-dev-server": "^3.10.1"
  },
  "engines": {
    "node": "16.x"
  }
}

但不幸的是,这并没有解决问题。我仍然收到巨大的错误流......有人看到类似的东西并能指出我正确的方向吗?完整流在这里:https://gist.github.com/jmzbond/8a8785321752c36e2e83a5c65697d734

remote: -----> Building on the Heroku-18 stack
remote: -----> Using buildpacks:
remote:        1. heroku/nodejs
remote:        2. heroku/ruby
remote: -----> Node.js app detected
remote:        
remote: -----> Creating runtime environment
remote:        
remote:        NPM_CONFIG_LOGLEVEL=error
remote:        USE_YARN_CACHE=true
remote:        NODE_ENV=production
remote:        NODE_MODULES_CACHE=true
remote:        NODE_VERBOSE=false
remote:        
remote: -----> Installing binaries
remote:        engines.node (package.json):  16.x
remote:        engines.npm (package.json):   unspecified (use default)
remote:        engines.yarn (package.json):  unspecified (use default)
remote:        
remote:        Resolving node version 16.x...
remote:        Downloading and installing node 16.14.2...
remote:        Using default npm version: 8.5.0
remote:        Resolving yarn version 1.22.x...
remote:        Downloading and installing yarn (1.22.18)
remote:        Installed yarn 1.22.18
remote:        
remote: -----> Installing dependencies
remote:        Installing node modules (yarn.lock)
remote:        yarn install v1.22.18
remote:        [1/4] Resolving packages...
remote:        [2/4] Fetching packages...
remote:        [3/4] Linking dependencies...
remote:        warning " > webpack-dev-server@3.10.1" has unmet peer dependency "webpack@^4.0.0 || ^5.0.0".
remote:        warning "webpack-dev-server > webpack-dev-middleware@3.7.2" has unmet peer dependency "webpack@^4.0.0".
remote:        [4/4] Building fresh packages...
remote:        error /tmp/build_f6dcc7a1/node_modules/node-sass: Command failed.
remote:        Exit code: 1
remote:        Command: node scripts/build.js
remote:        Arguments: 
remote:        Directory: /tmp/build_f6dcc7a1/node_modules/node-sass
remote:        Output:
remote:        Building: /tmp/build_f6dcc7a1/.heroku/node/bin/node /tmp/build_f6dcc7a1/node_modules/node-gyp/bin/node-gyp.js rebuild --verbose --libsass_ext= --libsass_cflags= --libsass_ldflags= --libsass_library=
remote:        gyp info it worked if it ends with ok
remote:        gyp verb cli [
remote:        gyp verb cli   '/tmp/build_f6dcc7a1/.heroku/node/bin/node',
remote:        gyp verb cli   '/tmp/build_f6dcc7a1/node_modules/node-gyp/bin/node-gyp.js',
remote:        gyp verb cli   'rebuild',
remote:        gyp verb cli   '--verbose',
remote:        gyp verb cli   '--libsass_ext=',
remote:        gyp verb cli   '--libsass_cflags=',
remote:        gyp verb cli   '--libsass_ldflags=',
remote:        gyp verb cli   '--libsass_library='
remote:        gyp verb cli ]
remote:        gyp info using node-gyp@3.8.0
remote:        gyp info using node@16.14.2 | linux | x64
remote:        gyp verb command rebuild []
remote:        gyp verb command clean []
remote:        gyp verb clean removing "build" directory
remote:        gyp verb command configure []
remote:        gyp verb check python checking for Python executable "python2" in the PATH
remote:        gyp verb `which` succeeded python2 /usr/bin/python2
remote:        gyp verb check python version `/usr/bin/python2 -c "import sys; print "2.7.17
remote:        gyp verb check python version .%s.%s" % sys.version_info[:3];"` returned: %j
remote:        gyp verb get node dir no --target version specified, falling back to host node version: 16.14.2
remote:        gyp verb command install [ '16.14.2' ]
remote:        gyp verb install input version string "16.14.2"
remote:        gyp verb install installing version: 16.14.2
remote:        gyp verb install --ensure was passed, so won't reinstall if already installed
remote:        gyp verb install version not already installed, continuing with install 16.14.2
remote:        gyp verb ensuring nodedir is created /app/.node-gyp/16.14.2
remote:        gyp verb created nodedir /app/.node-gyp
remote:        gyp http GET https://nodejs.org/download/release/v16.14.2/node-v16.14.2-headers.tar.gz
remote:        gyp http 200 https://nodejs.org/download/release/v16.14.2/node-v16.14.2-headers.tar.gz
remote:        gyp verb extracted file from tarball include/node/common.gypi
remote:        gyp verb extracted file from tarball include/node/config.gypi
# ...
# ...
# ...
# ...
# ... a lot more lines with extracted file info

remote:        gyp verb tarball done parsing tarball
remote:        gyp verb check download content checksum, need to download `SHASUMS256.txt`... 
remote:        gyp verb checksum url
https://nodejs.org/download/release/v16.14.2/SHASUMS256.txt
remote:        gyp verb checksum data {"node-v16.14.2-aix-ppc64.tar.gz":"acae171e4d58905e7e4c712a614de17bdf6a6720addbb5e440a94efda78807e4","node-v16.14.2-darwin-arm64.tar.gz":"a66d9217d2003bd416d3dd06dfd2c7a044c4c9ff2e43a27865790bd0d59c682d","node-v16.14.2-darwin-arm64.tar.xz":"d6fce58cab15017eba3529fe345a8dfcacbd37599ac8af6ec3e4e74d75c82b2b","node-v16.14.2-darwin-x64.tar.gz":"d3076ca7fcc7269c8ff9b03fe7d1c277d913a7e84a46a14eff4af7791ff9d055","node-v16.14.2-darwin-x64.tar.xz":"8c45f73fd1227ac6e9ad9127398251c381c9af1b2cd364fb32726dc5f38bf393","node-v16.14.2-headers.tar.gz":"505e1c287e55bb8ec25d2e20d7d87a57b0c2666e1aa7064e0661ad76b60db594","node-v16.14.2-headers.tar.xz":"a4e858e062af48cbf57b8505044f1fe38c7debeb7a9eeddcb3b16e90bff4c73b","node-v16.14.2-linux-arm64.tar.gz":"8a792a4cb6d83a960f7bd2901225c492e40ace541fbd73ff59ac4a332c3aaafb","node-v16.14.2-linux-arm64.tar.xz":"f7c5a573c06a520d6c2318f6ae204141b8420386553a692fc359f8ae3d88df96","node-v16.14.2-linux-armv7l.tar.gz":"339d6505835efdc3cda6f44af9db2b3ca5df240b7b34845a0b2d26342a4c328f","node-v16.14.2-linux-armv7l.tar.xz":"364ca85c71ce52eb2789bba223d6aed0b76c6f064e9f2074493388fb1c917245","node-v16.14.2-linux-ppc64le.tar.gz":"52884670d96d1b16d00b3dfd8f18f54649cd796aafbf66d574c92d2bddbd771b","node-v16.14.2-linux-ppc64le.tar.xz":"48469382586c9a1c0f372ed88cbb13870d225538a305eb35efcb7bd7732d330b","node-v16.14.2-linux-s390x.tar.gz":"39cfa5f998378e620c1f659bd933ea0460ee5cbec575e6831e27b4bf3e575525","node-v16.14.2-linux-s390x.tar.xz":"3197925919ca357e17a31132dc6ef4e5afae819fa09905cfe9f7ff7924a00bf5","node-v16.14.2-linux-x64.tar.gz":"57e02c27eb5e52f560f72d96240e898cb52818dc9fc50f45478ce39ece38583a","node-v16.14.2-linux-x64.tar.xz":"e40c6f81bfd078976d85296b5e657be19e06862497741ad82902d0704b34bb1b","node-v16.14.2.pkg":"ff790d712b5db675020b1e387e1824c45e71803e25d7356dc7399aaeff8caf65","node-v16.14.2.tar.gz":"082170f362c4da0e97f3a1899e3f5e4c998bbc245b803c77c6ab113a2b5cbd5f","node-v16.14.2.tar.xz":"e922e215cc68eb5f94d33e8a0b61e2c863b7731cc8600ab955d3822da90ff8d1","node-v16.14.2-win-x64.7z":"3f4b168eaa479397ec40ab8f514e2a924b078a032845fb896d364c0b4084b19c","node-v16.14.2-win-x64.zip":"4731da4fbb2015d414e871fa9118cabb643bdb6dbdc8a69a3ed563266ac93229","node-v16.14.2-win-x86.7z":"5b550768e452cf4d8039aa903c1e5881326c1837e7db6f14d5b11dea8302629a","node-v16.14.2-win-x86.zip":"b48aa66a6f35933bd048b4b1290ca0e5d43ffb31147618f29cbc60b5a2b43009","node-v16.14.2-x64.msi":"df1a010e89fd6fe1cca920425a165dffef45e6b1f072aeef9ed47eba8ff5f283","node-v16.14.2-x86.msi":"8d9bdfdfe8a3d18eb724f71b64a0dc41d18b1f6d904d4f35556e70d0fa3bece8","win-x64/node.exe":"92e971faed43bebbd8c8695167d9b5d732a322d6ffc0b8b3034560a119f8d487","win-x64/node.lib":"4b083c771184555dcc23bca56986e0761cf58ebce6ea2b27a81a524a18d5d7ee","win-x64/node_pdb.7z":"5d550962ef37620d36c58be08781660b3f118a3b1e6776c64729df6f5efbf06c","win-x64/node_pdb.zip":"420c2793f1ae4e5e8ae7b150800403f2753ca66ae1d0f9ad82f81d732e2ac67e","win-x86/node.exe":"34c7200f548fa5e6014211410b53edc187e59b9f75155e6afac23496b7b97cb7","win-x86/node.lib":"838696e87e61ac96bedbf45331be7e22f4cf5ad1fec1aef75b8dbbd49efa82a2","win-x86/node_pdb.7z":"db7b9eee61d1d598b832db323bebd145f16a2e225e19b43f72275e19c5b65793","win-x86/node_pdb.zip":"de87c0bf84c10553bf13732a4778c12e11b06efbaa9fd58a8b8c6a3c71b28862"}
remote:        gyp verb download contents checksum {"node-v16.14.2-headers.tar.gz":"505e1c287e55bb8ec25d2e20d7d87a57b0c2666e1aa7064e0661ad76b60db594"}
remote:        gyp verb validating download checksum for node-v16.14.2-headers.tar.gz (505e1c287e55bb8ec25d2e20d7d87a57b0c2666e1aa7064e0661ad76b60db594 == 505e1c287e55bb8ec25d2e20d7d87a57b0c2666e1aa7064e0661ad76b60db594)
remote:        gyp verb get node dir target node version installed: 16.14.2
remote:        gyp verb build dir attempting to create "build" dir: /tmp/build_f6dcc7a1/node_modules/node-sass/build
remote:        gyp verb build dir "build" dir needed to be created? /tmp/build_f6dcc7a1/node_modules/node-sass/build
remote:        gyp verb build/config.gypi creating config file
remote:        gyp verb build/config.gypi writing out config file: /tmp/build_f6dcc7a1/node_modules/node-sass/build/config.gypi
remote:        (node:1043) [DEP0150] DeprecationWarning: Setting process.config is deprecated. In the future the property will be read-only.
remote:        (Use `node --trace-deprecation ...` to show where the warning was created)
remote:        gyp verb config.gypi checking for gypi file: /tmp/build_f6dcc7a1/node_modules/node-sass/config.gypi
remote:        gyp verb common.gypi checking for gypi file: /tmp/build_f6dcc7a1/node_modules/node-sass/common.gypi
remote:        gyp verb gyp gyp format was not specified; forcing "make"
remote:        gyp info spawn /usr/bin/python2
remote:        gyp info spawn args [
# ...
# ...
remote:        make: Entering directory '/tmp/build_f6dcc7a1/node_modules/node-sass/build'
remote:          g++ '-DNODE_GYP_MODULE_NAME=libsass' '-DUSING_UV_SHARED=1' '-DUSING_V8_SHARED=1' '-DV8_DEPRECATION_WARNINGS=1' '-DV8_DEPRECATION_WARNINGS' '-DV8_IMMINENT_DEPRECATION_WARNINGS' '-D_GLIBCXX_USE_CXX11_ABI=1' '-D_LARGEFILE_SOURCE' '-D_FILE_OFFSET_BITS=64' '-D__STDC_FORMAT_MACROS' '-DOPENSSL_NO_PINSHARED' '-DOPENSSL_THREADS' '-DLIBSASS_VERSION="3.5.4"' -I/app/.node-gyp/16.14.2/include/node -I/app/.node-gyp/16.14.2/src -I/app/.node-gyp/16.14.2/deps/openssl/config -I/app/.node-gyp/16.14.2/deps/openssl/openssl/include -I/app/.node-gyp/16.14.2/deps/uv/include -I/app/.node-gyp/16.14.2/deps/zlib -I/app/.node-gyp/16.14.2/deps/v8/include -I../src/libsass/include  -fPIC -pthread -Wall -Wextra -Wno-unused-parameter -m64 -O3 -fno-omit-frame-pointer -std=gnu++14 -std=c++0x -fexceptions -frtti -MMD -MF ./Release/.deps/Release/obj.target/libsass/src/libsass/src/ast.o.d.raw   -c -o Release/obj.target/libsass/src/libsass/src/ast.o ../src/libsass/src/ast.cpp
remote:          g++ '-DNODE_GYP_MODULE_NAME=libsass' '-DUSING_UV_SHARED=1' '-DUSING_V8_SHARED=1' '-DV8_DEPRECATION_WARNINGS=1' '-DV8_DEPRECATION_WARNINGS' '-DV8_IMMINENT_DEPRECATION_WARNINGS' '-D_GLIBCXX_USE_CXX11_ABI=1' '-D_LARGEFILE_SOURCE' '-D_FILE_OFFSET_BITS=64' '-D__STDC_FORMAT_MACROS' '-DOPENSSL_NO_PINSHARED' '-DOPENSSL_THREADS' '-DLIBSASS_VERSION="3.5.4"' -I/app/.node-gyp/16.14.2/include/node -I/app/.node-gyp/16.14.2/src -I/app/.node-gyp/16.14.2/deps/openssl/config -I/app/.node-gyp/16.14.2/deps/openssl/openssl/include -I/app/.node-gyp/16.14.2/deps/uv/include -I/app/.node-gyp/16.14.2/deps/zlib -I/app/.node-gyp/16.14.2/deps/v8/include -I../src/libsass/include  -fPIC -pthread -Wall -Wextra -Wno-unused-parameter -m64 -O3 -fno-omit-frame-pointer -std=gnu++14 -std=c++0x -fexceptions -frtti -MMD -MF ./Release/.deps/Release/obj.target/libsass/src/libsass/src/ast_fwd_decl.o.d.raw   -c -o Release/obj.target/libsass/src/libsass/src/ast_fwd_decl.o ../src/libsass/src/ast_fwd_decl.cpp
remote:          g++ '-DNODE_GYP_MODULE_NAME=libsass' '-DUSING_UV_SHARED=1' '-DUSING_V8_SHARED=1' '-DV8_DEPRECATION_WARNINGS=1' '-DV8_DEPRECATION_WARNINGS' '-DV8_IMMINENT_DEPRECATION_WARNINGS' '-D_GLIBCXX_USE_CXX11_ABI=1' '-D_LARGEFILE_SOURCE' '-D_FILE_OFFSET_BITS=64' '-D__STDC_FORMAT_MACROS' '-DOPENSSL_NO_PINSHARED' '-DOPENSSL_THREADS' '-DLIBSASS_VERSION="3.5.4"' -I/app/.node-gyp/16.14.2/include/node -I/app/.node-gyp/16.14.2/src -I/app/.node-gyp/16.14.2/deps/openssl/config -I/app/.node-gyp/16.14.2/deps/openssl/openssl/include -I/app/.node-gyp/16.14.2/deps/uv/include -I/app/.node-gyp/16.14.2/deps/zlib -I/app/.node-gyp/16.14.2/deps/v8/include -I../src/libsass/include  -fPIC -pthread -Wall -Wextra -Wno-unused-parameter -m64 -O3 -fno-omit-frame-pointer -std=gnu++14 -std=c++0x -fexceptions -frtti -MMD -MF ./Release/.deps/Release/obj.target/libsass/src/libsass/src/backtrace.o.d.raw   -c -o Release/obj.target/libsass/src/libsass/src/backtrace.o ../src/libsass/src/backtrace.cpp
remote:          g++ '-DNODE_GYP_MODULE_NAME=libsass' '-DUSING_UV_SHARED=1' '-DUSING_V8_SHARED=1' '-DV8_DEPRECATION_WARNINGS=1' '-DV8_DEPRECATION_WARNINGS' '-DV8_IMMINENT_DEPRECATION_WARNINGS' '-D_GLIBCXX_USE_CXX11_ABI=1' '-D_LARGEFILE_SOURCE' '-D_FILE_OFFSET_BITS=64' '-D__STDC_FORMAT_MACROS' '-DOPENSSL_NO_PINSHARED' '-DOPENSSL_THREADS' '-DLIBSASS_VERSION="3.5.4"' -I/app/.node-gyp/16.14.2/include/node -I/app/.node-gyp/16.14.2/src -I/app/.node-gyp/16.14.2/deps/openssl/config -I/app/.node-gyp/16.14.2/deps/openssl/openssl/include -I/app/.node-gyp/16.14.2/deps/uv/include -I/app/.node-gyp/16.14.2/deps/zlib -I/app/.node-gyp/16.14.2/deps/v8/include -I../src/libsass/include  -fPIC -pthread -Wall -Wextra -Wno-unused-parameter -m64 -O3 -fno-omit-frame-pointer -std=gnu++14 -std=c++0x -fexceptions -frtti -MMD -MF ./Release/.deps/Release/obj.target/libsass/src/libsass/src/base64vlq.o.d.raw   -c -o Release/obj.target/libsass/src/libsass/src/base64vlq.o ../src/libsass/src/base64vlq.cpp
remote:          g++ '-DNODE_GYP_MODULE_NAME=libsass' '-DUSING_UV_SHARED=1' '-DUSING_V8_SHARED=1' '-DV8_DEPRECATION_WARNINGS=1' '-DV8_DEPRECATION_WARNINGS' '-DV8_IMMINENT_DEPRECATION_WARNINGS' '-D_GLIBCXX_USE_CXX11_ABI=1' '-D_LARGEFILE_SOURCE' '-D_FILE_OFFSET_BITS=64' '-D__STDC_FORMAT_MACROS' '-DOPENSSL_NO_PINSHARED' '-DOPENSSL_THREADS' '-DLIBSASS_VERSION="3.5.4"' -I/app/.node-gyp/16.14.2/include/node -I/app/.node-gyp/16.14.2/src -I/app/.node-gyp/16.14.2/deps/openssl/config -I/app/.node-gyp/16.14.2/deps/openssl/openssl/include -I/app/.node-gyp/16.14.2/deps/uv/include -I/app/.node-gyp/16.14.2/deps/zlib -I/app/.node-gyp/16.14.2/deps/v8/include -I../src/libsass/include  -fPIC -pthread -Wall -Wextra -Wno-unused-parameter -m64 -O3 -fno-omit-frame-pointer -std=gnu++14 -std=c++0x -fexceptions -frtti -MMD -MF ./Release/.deps/Release/obj.target/libsass/src/libsass/src/bind.o.d.raw   -c -o Release/obj.target/libsass/src/libsass/src/bind.o ../src/libsass/src/bind.cpp
remote:          cc '-DNODE_GYP_MODULE_NAME=libsass' '-DUSING_UV_SHARED=1' '-DUSING_V8_SHARED=1' '-DV8_DEPRECATION_WARNINGS=1' '-DV8_DEPRECATION_WARNINGS' '-DV8_IMMINENT_DEPRECATION_WARNINGS' '-D_GLIBCXX_USE_CXX11_ABI=1' '-D_LARGEFILE_SOURCE' '-D_FILE_OFFSET_BITS=64' '-D__STDC_FORMAT_MACROS' '-DOPENSSL_NO_PINSHARED' '-DOPENSSL_THREADS' '-DLIBSASS_VERSION="3.5.4"' -I/app/.node-gyp/16.14.2/include/node -I/app/.node-gyp/16.14.2/src -I/app/.node-gyp/16.14.2/deps/openssl/config -I/app/.node-gyp/16.14.2/deps/openssl/openssl/include -I/app/.node-gyp/16.14.2/deps/uv/include -I/app/.node-gyp/16.14.2/deps/zlib -I/app/.node-gyp/16.14.2/deps/v8/include -I../src/libsass/include  -fPIC -pthread -Wall -Wextra -Wno-unused-parameter -m64 -O3 -fno-omit-frame-pointer  -MMD -MF ./Release/.deps/Release/obj.target/libsass/src/libsass/src/cencode.o.d.raw   -c -o Release/obj.target/libsass/src/libsass/src/cencode.o ../src/libsass/src/cencode.c
remote:        ../src/libsass/src/cencode.c: In function ‘base64_encode_block’:
remote:        ../src/libsass/src/cencode.c:48:11: warning: this statement may fall through [-Wimplicit-fallthrough=]
remote:            result = (fragment & 0x003) << 4;
remote:            ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
remote:        ../src/libsass/src/cencode.c:52:2: note: here
remote:          case step_B:
remote:          ^~~~
remote:        ../src/libsass/src/cencode.c:62:11: warning: this statement may fall through [-Wimplicit-fallthrough=]
remote:            result = (fragment & 0x00f) << 2;
remote:            ~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~
remote:        ../src/libsass/src/cencode.c:66:2: note: here
remote:          case step_C:
remote:          ^~~~
# ...
# ...
# ...
# ...
remote:          g++ '-DNODE_GYP_MODULE_NAME=libsass' '-DUSING_UV_SHARED=1' '-DUSING_V8_SHARED=1' '-DV8_DEPRECATION_WARNINGS=1' '-DV8_DEPRECATION_WARNINGS' '-DV8_IMMINENT_DEPRECATION_WARNINGS' '-D_GLIBCXX_USE_CXX11_ABI=1' '-D_LARGEFILE_SOURCE' '-D_FILE_OFFSET_BITS=64' '-D__STDC_FORMAT_MACROS' '-DOPENSSL_NO_PINSHARED' '-DOPENSSL_THREADS' '-DLIBSASS_VERSION="3.5.4"' -I/app/.node-gyp/16.14.2/include/node -I/app/.node-gyp/16.14.2/src -I/app/.node-gyp/16.14.2/deps/openssl/config -I/app/.node-gyp/16.14.2/deps/openssl/openssl/include -I/app/.node-gyp/16.14.2/deps/uv/include -I/app/.node-gyp/16.14.2/deps/zlib -I/app/.node-gyp/16.14.2/deps/v8/include -I../src/libsass/include  -fPIC -pthread -Wall -Wextra -Wno-unused-parameter -m64 -O3 -fno-omit-frame-pointer -std=gnu++14 -std=c++0x -fexceptions -frtti -MMD -MF ./Release/.deps/Release/obj.target/libsass/src/libsass/src/values.o.d.raw   -c -o Release/obj.target/libsass/src/libsass/src/values.o ../src/libsass/src/values.cpp
remote:          rm -f Release/obj.target/src/sass.a && ar crs Release/obj.target/src/sass.a Release/obj.target/libsass/src/libsass/src/ast.o Release/obj.target/libsass/src/libsass/src/ast_fwd_decl.o 
# ... 
# ...
remote:          rm -rf "Release/sass.a" && cp -af "Release/obj.target/src/sass.a" "Release/sass.a"
remote:          g++ '-DNODE_GYP_MODULE_NAME=binding' '-DUSING_UV_SHARED=1' '-DUSING_V8_SHARED=1' '-DV8_DEPRECATION_WARNINGS=1' '-DV8_DEPRECATION_WARNINGS' '-DV8_IMMINENT_DEPRECATION_WARNINGS' '-D_GLIBCXX_USE_CXX11_ABI=1' '-D_LARGEFILE_SOURCE' '-D_FILE_OFFSET_BITS=64' '-D__STDC_FORMAT_MACROS' '-DOPENSSL_NO_PINSHARED' '-DOPENSSL_THREADS' '-DBUILDING_NODE_EXTENSION' -I/app/.node-gyp/16.14.2/include/node -I/app/.node-gyp/16.14.2/src -I/app/.node-gyp/16.14.2/deps/openssl/config -I/app/.node-gyp/16.14.2/deps/openssl/openssl/include -I/app/.node-gyp/16.14.2/deps/uv/include -I/app/.node-gyp/16.14.2/deps/zlib -I/app/.node-gyp/16.14.2/deps/v8/include -I../../nan -I../src/libsass/include  -fPIC -pthread -Wall -Wextra -Wno-unused-parameter -m64 -O3 -fno-omit-frame-pointer -fno-rtti -fno-exceptions -std=gnu++14 -std=c++0x -MMD -MF ./Release/.deps/Release/obj.target/binding/src/binding.o.d.raw   -c -o Release/obj.target/binding/src/binding.o ../src/binding.cpp
remote:        In file included from /app/.node-gyp/16.14.2/include/node/v8.h:30:0,
remote:                         from /app/.node-gyp/16.14.2/include/node/node.h:63,
remote:                         from ../../nan/nan.h:54,
remote:                         from ../src/binding.cpp:1:
remote:        /app/.node-gyp/16.14.2/include/node/v8-internal.h: In function ‘void v8::internal::PerformCastCheck(T*)’:
remote:        /app/.node-gyp/16.14.2/include/node/v8-internal.h:492:38: error: ‘remove_cv_t’ is not a member of ‘std’
remote:                     !std::is_same<Data, std::remove_cv_t<T>>::value>::Perform(data);
remote:                                              ^~~~~~~~~~~
remote:        /app/.node-gyp/16.14.2/include/node/v8-internal.h:492:38: note: suggested alternative: ‘remove_cv’
remote:                     !std::is_same<Data, std::remove_cv_t<T>>::value>::Perform(data);
remote:                                              ^~~~~~~~~~~
remote:                                              remove_cv
remote:        /app/.node-gyp/16.14.2/include/node/v8-internal.h:492:38: error: ‘remove_cv_t’ is not a member of ‘std’
remote:        /app/.node-gyp/16.14.2/include/node/v8-internal.h:492:38: note: suggested alternative: ‘remove_cv’
remote:                     !std::is_same<Data, std::remove_cv_t<T>>::value>::Perform(data);
remote:                                              ^~~~~~~~~~~
remote:                                              remove_cv
remote:        /app/.node-gyp/16.14.2/include/node/v8-internal.h:492:50: error: template argument 2 is invalid
remote:                     !std::is_same<Data, std::remove_cv_t<T>>::value>::Perform(data);
remote:                                                          ^
remote:        /app/.node-gyp/16.14.2/include/node/v8-internal.h:492:63: error: ‘::Perform’ has not been declared
remote:                     !std::is_same<Data, std::remove_cv_t<T>>::value>::Perform(data);
remote:                                                                       ^~~~~~~
remote:        /app/.node-gyp/16.14.2/include/node/v8-internal.h:492:63: note: suggested alternative: ‘herror’
remote:                     !std::is_same<Data, std::remove_cv_t<T>>::value>::Perform(data);
remote:                                                                       ^~~~~~~
remote:                                                                       herror
remote:        binding.target.mk:133: recipe for target 'Release/obj.target/binding/src/binding.o' failed
remote:        make: Leaving directory '/tmp/build_f6dcc7a1/node_modules/node-sass/build'
remote:        make: *** [Release/obj.target/binding/src/binding.o] Error 1
remote:        gyp ERR! build error 
remote:        gyp ERR! stack Error: `make` failed with exit code: 2
remote:        gyp ERR! stack     at ChildProcess.onExit (/tmp/build_f6dcc7a1/node_modules/node-gyp/lib/build.js:262:23)
remote:        gyp ERR! stack     at ChildProcess.emit (node:events:526:28)
remote:        gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:291:12)
remote:        gyp ERR! System Linux 4.4.0-1101-aws
remote:        gyp ERR! command "/tmp/build_f6dcc7a1/.heroku/node/bin/node" "/tmp/build_f6dcc7a1/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
remote:        gyp ERR! cwd /tmp/build_f6dcc7a1/node_modules/node-sass
remote:        gyp ERR! node -v v16.14.2
remote:        gyp ERR! node-gyp -v v3.8.0
remote:        gyp ERR! not ok 
remote:        Build failed with error code: 1
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/

更新,当降级到节点 14 或 12(在 packages.json 中指定)时,出现新错误:

remote: -----> Detecting rake tasks
remote: -----> Preparing app for Rails asset pipeline
remote:        Running: rake assets:precompile
remote:        yarn install v1.22.18
remote:        [1/5] Validating package.json...
remote:        [2/5] Resolving packages...
remote:        [3/5] Fetching packages...
remote:        [4/5] Linking dependencies...
remote:        warning " > webpack-dev-server@3.10.1" has unmet peer dependency "webpack@^4.0.0 || ^5.0.0".
remote:        warning "webpack-dev-server > webpack-dev-middleware@3.7.2" has unmet peer dependency "webpack@^4.0.0".
remote:        [5/5] Building fresh packages...
remote:        Done in 17.43s.
remote:        yarn install v1.22.18
remote:        [1/5] Validating package.json...
remote:        [2/5] Resolving packages...
remote:        [3/5] Fetching packages...
remote:        [4/5] Linking dependencies...
remote:        warning " > webpack-dev-server@3.10.1" has unmet peer dependency "webpack@^4.0.0 || ^5.0.0".
remote:        warning "webpack-dev-server > webpack-dev-middleware@3.7.2" has unmet peer dependency "webpack@^4.0.0".
remote:        [5/5] Building fresh packages...
remote:        Done in 2.46s.
remote:        Compiling...
remote:        Compilation failed:
remote:        Hash: 7e4370e94305cc4b9b02
remote:        Version: webpack 4.41.5
remote:        Time: 507ms
remote:        Built at: 03/24/2022 5:00:33 PM
remote:         8 assets
remote:        Entrypoint application = js/application-4f23df965b2165b7f041.js js/application-4f23df965b2165b7f041.js.map
remote:        Entrypoint jasmine = js/jasmine-d8b8975acaa6cfb2b2bf.js js/jasmine-d8b8975acaa6cfb2b2bf.js.map
remote:        Entrypoint sites_manage = js/sites_manage-13c9c9ba6fdcdc7aafd1.js js/sites_manage-13c9c9ba6fdcdc7aafd1.js.map
remote:        Entrypoint specs = js/specs-4cac5a803bb1c566a801.js js/specs-4cac5a803bb1c566a801.js.map
remote:        [0] ./app/javascript/packs/application.js 3.08 KiB {0} [built] [failed] [1 error]
remote:        [1] ./app/javascript/packs/jasmine.js 3.08 KiB {1} [built] [failed] [1 error]
remote:        [2] ./app/javascript/packs/sites_manage.js 3.08 KiB {2} [built] [failed] [1 error]
remote:        [3] ./app/javascript/packs/specs.js 3.08 KiB {3} [built] [failed] [1 error]

其他 4 个错误中的每一个都有以下详细信息

remote:        ERROR in ./app/javascript/packs/specs.js
remote:        Module build failed (from ./node_modules/babel-loader/lib/index.js):
remote:        Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: No "exports" main defined in /tmp/build_26758029/node_modules/@babel/helper-compilation-targets/package.json
remote:            at new NodeError (internal/errors.js:322:7)
remote:            at throwExportsNotFound (internal/modules/esm/resolve.js:332:9)
remote:            at packageExportsResolve (internal/modules/esm/resolve.js:565:3)
remote:            at resolveExports (internal/modules/cjs/loader.js:450:36)
remote:            at Function.Module._findPath (internal/modules/cjs/loader.js:490:31)
remote:            at Function.Module._resolveFilename (internal/modules/cjs/loader.js:888:27)
remote:            at Function.Module._load (internal/modules/cjs/loader.js:746:27)
remote:            at Module.require (internal/modules/cjs/loader.js:974:19)
remote:            at require (/tmp/build_26758029/node_modules/v8-compile-cache/v8-compile-cache.js:161:20)
remote:            at Object.<anonymous> (/tmp/build_26758029/node_modules/@babel/preset-env/lib/debug.js:8:33)
remote:            at Module._compile (/tmp/build_26758029/node_modules/v8-compile-cache/v8-compile-cache.js:192:30)
remote:            at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
remote:            at Module.load (internal/modules/cjs/loader.js:950:32)
remote:            at Function.Module._load (internal/modules/cjs/loader.js:790:12)
remote:            at Module.require (internal/modules/cjs/loader.js:974:19)
remote:            at require (/tmp/build_26758029/node_modules/v8-compile-cache/v8-compile-cache.js:161:20)
remote:            at Object.<anonymous> (/tmp/build_26758029/node_modules/@babel/preset-env/lib/index.js:11:14)
remote:            at Module._compile (/tmp/build_26758029/node_modules/v8-compile-cache/v8-compile-cache.js:192:30)
remote:            at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
remote:            at Module.load (internal/modules/cjs/loader.js:950:32)
remote:            at Function.Module._load (internal/modules/cjs/loader.js:790:12)
remote:            at Module.require (internal/modules/cjs/loader.js:974:19)
remote:            at require (/tmp/build_26758029/node_modules/v8-compile-cache/v8-compile-cache.js:161:20)
remote:            at requireModule (/tmp/build_26758029/node_modules/@babel/core/lib/config/files/plugins.js:165:12)
remote:            at loadPreset (/tmp/build_26758029/node_modules/@babel/core/lib/config/files/plugins.js:83:17)
remote:            at createDescriptor (/tmp/build_26758029/node_modules/@babel/core/lib/config/config-descriptors.js:154:9)
remote:            at /tmp/build_26758029/node_modules/@babel/core/lib/config/config-descriptors.js:109:50
remote:            at Array.map (<anonymous>)
remote:            at createDescriptors (/tmp/build_26758029/node_modules/@babel/core/lib/config/config-descriptors.js:109:29)
remote:            at createPresetDescriptors (/tmp/build_26758029/node_modules/@babel/core/lib/config/config-descriptors.js:101:10)
remote:            at presets (/tmp/build_26758029/node_modules/@babel/core/lib/config/config-descriptors.js:47:19)
remote:            at mergeChainOpts (/tmp/build_26758029/node_modules/@babel/core/lib/config/config-chain.js:320:26)
remote:            at /tmp/build_26758029/node_modules/@babel/core/lib/config/config-chain.js:283:7
remote:            at Generator.next (<anonymous>)
remote:            at buildRootChain (/tmp/build_26758029/node_modules/@babel/core/lib/config/config-chain.js:90:27)
remote:            at buildRootChain.next (<anonymous>)
remote:        

webpacker 尝试安装的 node-sass 版本与此类新版本的 NodeJS 不兼容。 Webpacker 4.2.2 specifies node-sass version ^4.13.0. When I do a test install, it looks like this is resolving to 4.14.1, which according to node-sass's compatibility table,与节点 14 之后的任何版本都不兼容。

尝试在您的 engines 配置中指定节点 14,如果这不起作用,则指定节点 12。节点 14 在我的快速测试中有效。

用版本 12.x 指定 packages.json 是不够的。我确实必须为 nodeyarn 指定我在本地使用的版本。在我的例子中是:

"engines": {
    "node": "13.7.0",
    "yarn":"1.21.1"
  }

如果对其他人有帮助,只需在终端中输入 node -vyarn -v 即可找到。

谢谢,我在推送到 heroku 时遇到了这个错误:

 gyp ERR! build error 
remote:        gyp ERR! stack Error: `make` failed with exit code: 2
remote:        gyp ERR! stack     at ChildProcess.onExit (/tmp/build_0b05028b/node_modules/node-gyp/lib/build.js:262:23)
remote:        gyp ERR! stack     at ChildProcess.emit (node:events:527:28)
remote:        gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:291:12)
remote:        gyp ERR! System Linux 4.4.0-1101-aws
remote:        gyp ERR! command "/tmp/build_0b05028b/.heroku/node/bin/node" "/tmp/build_0b05028b/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
remote:        gyp ERR! cwd /tmp/build_0b05028b/node_modules/node-sass
remote:        gyp ERR! node -v v16.15.0
remote:        gyp ERR! node-gyp -v v3.8.0
remote:        gyp ERR! not ok 
remote:        Build failed with error code: 1
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:        Some possible problems:
remote:        
remote:        - Node version not specified in package.json
remote:          https://devcenter.heroku.com/articles/nodejs-support#specifying-a-node-js-version

并且在 packages.json 中指定节点和纱线版本对我有用!