Hi i was deploying a branch on heroku and threw up this error. I also tried deploying a branch which worked perfectly, but that is also showing the same error.
local yarn verion : 1.22.17 local node version : v12.22.7 Please help !!!
Tried building without yarn.lock and package-lock same thing.
This is how it starts Heroku deployment build log through CLI
yarn install v1.22.17
remote: warning package-lock.json found. Your project contains lock files generated by tools other than Yarn. It is advised not to mix package managers in order to avoid resolution inconsistencies caused by unsynchronized lock files. To clear this warning, remove package-lock.json.
remote: [1/5] Validating package.json...
remote: [2/5] Resolving packages...
remote: [3/5] Fetching packages...
remote: [4/5] Linking dependencies...
remote: warning " > [email protected]" has unmet peer dependency "webpack@^4.37.0 || ^5.0.0".
remote: warning "webpack-dev-server > [email protected]" has unmet peer dependency "webpack@^4.0.0 || ^5.0.0".
remote: [5/5] Building fresh packages...
remote: error /tmp/build_df192222/node_modules/@rails/webpacker/node_modules/node-sass: Command failed.
remote: Exit code: 1
remote: Command: node scripts/build.js
remote: Arguments:
remote: Directory: /tmp/build_df192222/node_modules/@rails/webpacker/node_modules/node-sass
remote: Output:
remote: Building: /tmp/build_df192222/bin/node /tmp/build_df192222/node_modules/@rails/webpacker/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_df192222/bin/node',
remote: gyp verb cli '/tmp/build_df192222/node_modules/@rails/webpacker/node_modules/node-gyp/bin/node-gyp.js',
remote: gyp verb cli 'rebuild',
. . . . . `
remote: /app/.node-gyp/16.13.1/include/node/v8-internal.h: In function ‘void v8::internal::PerformCastCheck(T*)’:
remote: /app/.node-gyp/16.13.1/include/node/v8-internal.h:492:38: error: ‘remove_cv_t’ is not a member of ‘std’; did you mean ‘remove_cv’?
remote: 492 | !std::is_same<Data, std::remove_cv_t<T>>::value>::Perform(data);
remote: | ^~~~~~~~~~~
remote: | remove_cv
remote: /app/.node-gyp/16.13.1/include/node/v8-internal.h:492:38: error: ‘remove_cv_t’ is not a member of ‘std’; did you mean ‘remove_cv’?
remote: 492 | !std::is_same<Data, std::remove_cv_t<T>>::value>::Perform(data);
remote: | ^~~~~~~~~~~
remote: | remove_cv
remote: /app/.node-gyp/16.13.1/include/node/v8-internal.h:492:50: error: template argument 2 is invalid
remote: 492 | !std::is_same<Data, std::remove_cv_t<T>>::value>::Perform(data);
remote: | ^
remote: /app/.node-gyp/16.13.1/include/node/v8-internal.h:492:63: error: ‘::Perform’ has not been declared
remote: 492 | !std::is_same<Data, std::remove_cv_t<T>>::value>::Perform(data);
remote: | ^~~~~~~
remote: ../src/binding.cpp: In function ‘Nan::NAN_METHOD_RETURN_TYPE render(Nan::NAN_METHOD_ARGS_TYPE)’:
remote: ../src/binding.cpp:284:98: warning: cast between incompatible function types from ‘void (*)(uv_work_t*)’ {aka ‘void (*)(uv_work_s*)’} to ‘uv_after_work_cb’ {aka ‘void (*)(uv_work_s*, int)’} [-Wcast-function-type]
remote: 284 | int status = uv_queue_work(uv_default_loop(), &ctx_w->request, compile_it, (uv_after_work_cb)MakeCallback);
remote: | ^~~~~~~~~~~~
remote: ../src/binding.cpp: In function ‘Nan::NAN_METHOD_RETURN_TYPE render_file(Nan::NAN_METHOD_ARGS_TYPE)’:
remote: ../src/binding.cpp:320:98: warning: cast between incompatible function types from ‘void (*)(uv_work_t*)’ {aka ‘void (*)(uv_work_s*)’} to ‘uv_after_work_cb’ {aka ‘void (*)(uv_work_s*, int)’} [-Wcast-function-type]
remote: 320 | int status = uv_queue_work(uv_default_loop(), &ctx_w->request, compile_it, (uv_after_work_cb)MakeCallback);
remote: | ^~~~~~~~~~~~
remote: In file included from ../../../../../nan/nan.h:58,
remote: from ../src/binding.cpp:1:
remote: ../src/binding.cpp: At global scope:
remote: /app/.node-gyp/16.13.1/include/node/node.h:821:43: warning: cast between incompatible function types from ‘void (*)(Nan::ADDON_REGISTER_FUNCTION_ARGS_TYPE)’ {aka ‘void (*)(v8::Local<v8::Object>)’} to ‘node::addon_register_func’ {aka ‘void (*)(v8::Local<v8::Object>, v8::Local<v8::Value>, void*)’} [-Wcast-function-type]
remote: 821 | (node::addon_register_func) (regfunc), \
remote: | ^
remote: /app/.node-gyp/16.13.1/include/node/node.h:855:3: note: in expansion of macro ‘NODE_MODULE_X’
remote: 855 | NODE_MODULE_X(modname, regfunc, NULL, 0) // NOLINT (readability/null_usage)
remote: | ^~~~~~~~~~~~~
remote: ../src/binding.cpp:358:1: note: in expansion of macro ‘NODE_MODULE’
remote: 358 | NODE_MODULE(binding, RegisterModule);
remote: | ^~~~~~~~~~~
remote: make: *** [binding.target.mk:133: Release/obj.target/binding/src/binding.o] Error 1
remote: make: Leaving directory '/tmp/build_df192222/node_modules/@rails/webpacker/node_modules/node-sass/build'
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_df192222/node_modules/@rails/webpacker/node_modules/node-gyp/lib/build.js:262:23)
remote: gyp ERR! stack at ChildProcess.emit (node:events:390:28)
remote: gyp ERR! stack at Process.ChildProcess._handle.onexit (node:internal/child_process:290:12)
remote: gyp ERR! System Linux 4.4.0-1097-aws
remote: gyp ERR! command "/tmp/build_df192222/bin/node" "/tmp/build_df192222/node_modules/@rails/webpacker/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
remote: gyp ERR! cwd /tmp/build_df192222/node_modules/@rails/webpacker/node_modules/node-sass
remote: gyp ERR! node -v v16.13.1
remote: gyp ERR! node-gyp -v v3.8.0
remote: gyp ERR! not ok
remote: Build failed with error code: 1
remote:
remote: !
remote: ! Precompiling assets failed.
remote: !
remote: ! Push rejected, failed to compile Ruby app.
remote:
remote: ! Push failed
Though it is a Rails app I added node in engines to package.json.
{
"name": "travel_empire",
"private": true,
"dependencies": {
"@fortawesome/fontawesome-free": "^5.15.4",
"@popperjs/core": "^2.10.2",
"@rails/actioncable": "^6.0.0",
"@rails/activestorage": "^6.0.0",
"@rails/ujs": "^6.0.0",
"@rails/webpacker": "4.3.0",
"bootstrap": "4.3.1",
"bootstrap-icons": "^1.5.0",
"easy-autocomplete": "^1.3.5",
"jquery": "^3.6.0",
"jquery-ui-dist": "^1.12.1",
"js-autocomplete": "^1.0.4",
"node-sass": "^7.0.0",
"popper.js": "^1.16.1",
"turbolinks": "^5.2.0"
},
"version": "0.1.0",
"devDependencies": {
"webpack-dev-server": "^4.6.0"
},
"engines": {
"node": "16.x"
}
}
Gemfile
source 'https://rubygems.org'
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
ruby '2.7.3'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '~> 6.0.3', '>= 6.0.3.7'
gem 'mongoid', git: 'https://github.com/mongodb/mongoid.git'
# Use Puma as the app server
gem 'puma', '~> 4.1'
# Use SCSS for stylesheets
gem 'sass-rails', '>= 6'
# Transpile app-like JavaScript. Read more: https://github.com/rails/webpacker
gem 'webpacker', '~> 4.0'
# Turbolinks makes navigating your web application faster. Read more: https://github.com/turbolinks/turbolinks
gem 'turbolinks', '~> 5'
# Build JSON APIs with ease. Read more: https://github.com/rails/jbuilder
gem 'jbuilder', '~> 2.7'
# Use Redis adapter to run Action Cable in production
# gem 'redis', '~> 4.0'
# Use Active Model has_secure_password
# Use Active Storage variant
# gem 'image_processing', '~> 1.2'
gem 'axlsx'
gem 'caxlsx_rails'
#Bootstrap for UI
gem 'bootstrap', '~> 5.1.0'
gem 'bootstrap-timepicker-rails', '~> 0.1.3'
gem 'bootstrap-select-rails', '~> 1.6', '>= 1.6.3'
#JQuery Rails
gem 'jquery-rails'
gem 'rails_12factor', group: :production
# Reduces boot times through caching; required in config/boot.rb
gem 'bootsnap', '>= 1.4.2', require: false
group :development, :test do
# Call 'byebug' anywhere in the code to stop execution and get a debugger console
gem 'byebug', platforms: [:mri, :mingw, :x64_mingw]
end
group :development do
# Access an interactive console on exception pages or by calling 'console' anywhere in the code.
gem 'web-console', '>= 3.3.0'
gem 'listen', '~> 3.2'
gem 'pry'
# Spring speeds up development by keeping your application running in the background. Read more: https://github.com/rails/spring
gem 'spring'
gem 'spring-watcher-listen', '~> 2.0.0'
end
group :test do
# Adds support for Capybara system testing and selenium driver
gem 'capybara', '>= 2.15'
gem 'selenium-webdriver'
# Easy installation and use of web drivers to run system tests with browsers
gem 'webdrivers'
gem 'cucumber-rails', require: false
gem 'database_cleaner'
end
# Windows does not include zoneinfo files, so bundle the tzinfo-data gem
gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]
#HTTParty for RESTful API calls
gem 'httparty'
#Paperclip for storing files
gem 'paperclip'
gem "mongoid-paperclip", :require => "mongoid_paperclip"
gem "letter_opener", :group => :development
CodePudding user response:
I had a similar problem but resolved by following steps.
- Run the following command.
heroku buildpacks:add heroku/nodejs --index 1
- Update node version from
16.x
to12.16.2
in package.json.
CodePudding user response:
It seems that Heroku have updated their version of node used in their build process, because I was also receiving the same error message related to webpacker:
[4/4] Building fresh packages...
error /tmp/build_1ea87a91/node_modules/@rails/webpacker/node_modules/node-sass: Command failed.
Exit code: 1
My deployments were failing because of rails/webpacker 4.3.0 in my app. With a little help from my friends, I resolved the issue by upgrading to webpacker 5.4.3.
You can upgrade the webpacker verson in your package.json file to 5.4.3, or by running the command below if your using yarn:
yarn upgrade @rails/webpacker --latest