首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >无法在heroku上构建和部署Rails 6.0.4.1应用程序--抛出gyp动词cli错误

无法在heroku上构建和部署Rails 6.0.4.1应用程序--抛出gyp动词cli错误
EN

Stack Overflow用户
提问于 2021-12-18 04:49:47
回答 3查看 2.5K关注 0票数 4

嗨,我在heroku上部署了一个分支,并抛出了这个错误。我还试着部署一个运行良好的分支,但这也显示了同样的错误。

本地纱线verion : 1.22.17本地节点版本: v12.22.7请帮助!

试着在没有yarn.lock和包锁的情况下建房子。

这就是它如何通过CLI启动Heroku部署构建日志。

代码语言:javascript
运行
复制
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 " > webpack-dev-server@4.6.0" has unmet peer dependency "webpack@^4.37.0 || ^5.0.0".
remote:        warning "webpack-dev-server > webpack-dev-middleware@5.2.1" 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',

。。。。。`

代码语言:javascript
运行
复制
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

虽然它是一个Rails应用程序,但我在package.json中添加了引擎中的节点。

代码语言:javascript
运行
复制
{
  "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

代码语言:javascript
运行
复制
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
EN

Stack Overflow用户

发布于 2022-01-02 10:07:09

欲了解更多信息:

由于nodejs & ruby构建包已经按以下顺序设置在我的应用程序上:

代码语言:javascript
运行
复制
$ heroku buildpacks
=== myapp Buildpack URLs
1. heroku/ruby
2. heroku/nodejs

下面的命令heroku buildpacks:add heroku/nodejs --index 1没有工作。

我不得不使用以下命令删除它们:

代码语言:javascript
运行
复制
heroku buildpacks:remove heroku/ruby
heroku buildpacks:remove heroku/nodejs

并重新添加它们(按此顺序):

代码语言:javascript
运行
复制
heroku buildpacks:add heroku/nodejs
heroku buildpacks:add heroku/ruby

最后,通过我的package.json在Heroku上指定一个节点版本

代码语言:javascript
运行
复制
   {
      "engines": {
        "node": "12.16.2"
      }
    }

这个link对于解决我的问题也很有用。

票数 2
EN
查看全部 3 条回答
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/70401055

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档