Heroku 部署资产预编译在 Rails 6 上失败

Hen*_*adi 2 ruby ruby-on-rails heroku

我需要帮助。当尝试将我的应用程序上传到heroku时,我收到此错误,有人知道为什么吗?

\n

此链接上的完整错误https://pastebin.com/GZCziNpM

\n
remote:          821 |       (node::addon_register_func) (regfunc),                          \\\nremote:              |                                           ^\nremote:        /app/.node-gyp/16.13.1/include/node/node.h:855:3: note: in expansion of macro \xe2\x80\x98NODE_MODULE_X\xe2\x80\x99\nremote:          855 |   NODE_MODULE_X(modname, regfunc, NULL, 0)  // NOLINT (readability/null_usage)\nremote:              |   ^~~~~~~~~~~~~\nremote:        ../src/binding.cpp:358:1: note: in expansion of macro \xe2\x80\x98NODE_MODULE\xe2\x80\x99\nremote:          358 | NODE_MODULE(binding, RegisterModule);\nremote:              | ^~~~~~~~~~~\nremote:        make: *** [binding.target.mk:133: Release/obj.target/binding/src/binding.o] Error 1\nremote:        make: Leaving directory \'/tmp/build_6edbe6b2/node_modules/node-sass/build\'\nremote:        gyp ERR! build error \nremote:        gyp ERR! stack Error: `make` failed with exit code: 2\nremote:        gyp ERR! stack     at ChildProcess.onExit (/tmp/build_6edbe6b2/node_modules/node-gyp/lib/build.js:262:23)\nremote:        gyp ERR! stack     at ChildProcess.emit (node:events:390:28)\nremote:        gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:290:12)\nremote:        gyp ERR! System Linux 4.4.0-1097-aws\nremote:        gyp ERR! command "/tmp/build_6edbe6b2/bin/node" "/tmp/build_6edbe6b2/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="\nremote:        gyp ERR! cwd /tmp/build_6edbe6b2/node_modules/node-sass\nremote:        gyp ERR! node -v v16.13.1\nremote:        gyp ERR! node-gyp -v v3.8.0\nremote:        gyp ERR! not ok \nremote:        Build failed with error code: 1\nremote:        D, [2021-12-27T03:59:25.594596 #299] DEBUG -- [Bugsnag]: Not notifying SystemExit due to ignore being signified in internal middlewares\nremote:        D, [2021-12-27T03:59:25.597384 #299] DEBUG -- [Bugsnag]: Not notifying SystemExit due to ignore being signified in internal middlewares\nremote: \nremote:  !\nremote:  !     Precompiling assets failed.\nremote:  !\nremote:  !     Push rejected, failed to compile Ruby app.\nremote: \nremote:  !     Push failed\nremote:  !\nremote: \nremote: Verifying deploy...\nremote: \nremote: !       Push rejected to cards-staging.\nremote: \n
Run Code Online (Sandbox Code Playgroud)\n

我已将其添加到 config/application.rb 上,但没有区别

\n
config.assets.initialize_on_precompile = false\n
Run Code Online (Sandbox Code Playgroud)\n

我已经部署了好几次了,我发现 public/assets 文件夹有问题,所以我需要在本地部署它。有什么建议可以解决这个问题吗?

\n

Hen*_*adi 6

实际上我的 webpacker 已经过时了,所以我只需要将其更新到最新版本,然后它就可以再次使用了

yarn upgrade @rails/webpacker --latest
Run Code Online (Sandbox Code Playgroud)