LoginSignup
2
2

More than 3 years have passed since last update.

Rails6系にadmin-lte入れてHerokuにデプロイするとコケるエラーの解消法

Posted at

プッシュしたときのエラー内容

Enumerating objects: 7, done.
Counting objects: 100% (7/7), done.
Delta compression using up to 4 threads
Compressing objects: 100% (4/4), done.
Writing objects: 100% (4/4), 21.87 KiB | 3.12 MiB/s, done.
Total 4 (delta 3), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote: 
remote: -----> Ruby app detected
remote: -----> Compiling Ruby/Rails
remote: -----> Using Ruby version: ruby-2.6.3
remote: -----> Installing dependencies using bundler 1.17.3
remote:        Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin -j4 --deployment
remote:        The dependency tzinfo-data (>= 0) will be unused by any of the platforms Bundler is installing for. Bundler is installing for ruby but the dependency is only for x86-mingw32, x86-mswin32, x64-mingw32, java. To add those platforms to the bundle, run `bundle lock --add-platform x86-mingw32 x86-mswin32 x64-mingw32 java`.
remote:        Using rake 13.0.1
remote:        Using concurrent-ruby 1.1.5
remote:        Using i18n 1.7.0
remote:        Using minitest 5.13.0
remote:        Using thread_safe 0.3.6
remote:        Using tzinfo 1.2.5
remote:        Using zeitwerk 2.2.1
remote:        Using activesupport 6.0.1
remote:        Using builder 3.2.3
remote:        Using erubi 1.9.0
remote:        Using mini_portile2 2.4.0
remote:        Using nokogiri 1.10.5
remote:        Using rails-dom-testing 2.0.3
remote:        Using crass 1.0.5
remote:        Using loofah 2.3.1
remote:        Using rails-html-sanitizer 1.3.0
remote:        Using actionview 6.0.1
remote:        Using rack 2.0.7
remote:        Using rack-test 1.1.0
remote:        Using actionpack 6.0.1
remote:        Using nio4r 2.5.2
remote:        Using websocket-extensions 0.1.4
remote:        Using websocket-driver 0.7.1
remote:        Using actioncable 6.0.1
remote:        Using globalid 0.4.2
remote:        Using activejob 6.0.1
remote:        Using activemodel 6.0.1
remote:        Using activerecord 6.0.1
remote:        Using mimemagic 0.3.3
remote:        Using marcel 0.3.3
remote:        Using activestorage 6.0.1
remote:        Using mini_mime 1.0.2
remote:        Using mail 2.7.1
remote:        Using actionmailbox 6.0.1
remote:        Using actionmailer 6.0.1
remote:        Using actiontext 6.0.1
remote:        Using msgpack 1.3.1
remote:        Using bootsnap 1.4.5
remote:        Using bundler 1.17.3
remote:        Using ffi 1.11.2
remote:        Using jbuilder 2.9.1
remote:        Using method_source 0.9.2
remote:        Using pg 1.1.4
remote:        Using puma 4.3.0
remote:        Using rack-proxy 0.6.5
remote:        Using thor 0.20.3
remote:        Using railties 6.0.1
remote:        Using sprockets 4.0.0
remote:        Using sprockets-rails 3.2.1
remote:        Using rails 6.0.1
remote:        Using sassc 2.2.1
remote:        Using tilt 2.0.10
remote:        Using sassc-rails 2.1.2
remote:        Using sass-rails 6.0.0
remote:        Using turbolinks-source 5.2.0
remote:        Using turbolinks 5.2.1
remote:        Using webpacker 4.2.0
remote:        Bundle complete! 18 Gemfile dependencies, 57 gems now installed.
remote:        Gems in the groups development and test were not installed.
remote:        Bundled gems are installed into `./vendor/bundle`
remote:        Bundle completed (0.45s)
remote:        Cleaning up the bundler cache.
remote:        The dependency tzinfo-data (>= 0) will be unused by any of the platforms Bundler is installing for. Bundler is installing for ruby but the dependency is only for x86-mingw32, x86-mswin32, x64-mingw32, java. To add those platforms to the bundle, run `bundle lock --add-platform x86-mingw32 x86-mswin32 x64-mingw32 java`.
remote: -----> Installing node-v10.15.3-linux-x64
remote: -----> Installing yarn-v1.16.0
remote: -----> Detecting rake tasks
remote: -----> Preparing app for Rails asset pipeline
remote:        Running: rake assets:precompile
remote:        yarn install v1.16.0
remote:        [1/4] Resolving packages...
remote:        [2/4] Fetching packages...
remote:        info fsevents@1.2.9: The platform "linux" is incompatible with this module.
remote:        info "fsevents@1.2.9" is an optional dependency and failed compatibility check. Excluding it from installation.
remote:        [3/4] Linking dependencies...
remote:        warning "admin-lte > tempusdominus-bootstrap-4@5.1.2" has unmet peer dependency "moment-timezone@^0.5.11".
remote:        warning "admin-lte > tempusdominus-bootstrap-4@5.1.2" has unmet peer dependency "tempusdominus-core@5.0.3".
remote:        warning " > webpack-dev-server@3.9.0" has unmet peer dependency "webpack@^4.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_76a1a467ecf142c276b2564942986e82/node_modules/admin-lte: Command failed.
remote:        Exit code: 127
remote:        Command: npm run plugins
remote:        Arguments: 
remote:        Directory: /tmp/build_76a1a467ecf142c276b2564942986e82/node_modules/admin-lte
remote:        Output:
remote:        /bin/sh: 1: npm: not found
remote:        info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
remote: 
remote:  !
remote:  !     Precompiling assets failed.
remote:  !
remote:  !     Push rejected, failed to compile Ruby app.
remote: 
remote:  !     Push failed
remote: Verifying deploy...
remote: 
remote: !       Push rejected to desolate-gorge-64361.
remote: 
To https://git.heroku.com/desolate-gorge-64361.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/desolate-gorge-64361.git'

最初は error /tmp/build_76a1a467ecf142c276b2564942986e82/node_modules/admin-lte: Command failed. この部分が赤文字だったのでそこらへんでググってたところあんまり得たい情報がなかったのでログを見直したらなんと /bin/sh: 1: npm: not found npmが見つからないとw?!

ってことでnodeのビルドパックを追加することに↓

ビルドパックの追加時のログ

$ heroku buildpacks:set heroku/nodejs

Buildpack set. Next release on desolate-gorge-64361 will use heroku/nodejs.
Run git push heroku master to create a new release using this buildpack.

指示された通りに git push heroku master !!

再度push

Enumerating objects: 7, done.
Counting objects: 100% (7/7), done.
Delta compression using up to 4 threads
Compressing objects: 100% (4/4), done.
Writing objects: 100% (4/4), 21.87 KiB | 1.68 MiB/s, done.
Total 4 (delta 3), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote: 
remote: -----> Node.js app detected
remote:        
remote: -----> Creating runtime environment
remote:        
remote:        NPM_CONFIG_LOGLEVEL=error
remote:        NODE_ENV=production
remote:        NODE_MODULES_CACHE=true
remote:        NODE_VERBOSE=false
remote:        
remote: -----> Installing binaries
remote:        engines.node (package.json):  unspecified
remote:        engines.npm (package.json):   unspecified (use default)
remote:        engines.yarn (package.json):  unspecified (use default)
remote:        
remote:        Resolving node version 12.x...
remote:        Downloading and installing node 12.13.0...
remote:        Using default npm version: 6.12.0
remote:        Resolving yarn version 1.x...
remote:        Downloading and installing yarn (1.19.1)...
remote:        Installed yarn 1.19.1
remote:        
remote: -----> Installing dependencies
remote:        Installing node modules (yarn.lock)
remote:        yarn install v1.19.1
remote:        [1/4] Resolving packages...
remote:        [2/4] Fetching packages...
remote:        info fsevents@1.2.9: The platform "linux" is incompatible with this module.
remote:        info "fsevents@1.2.9" is an optional dependency and failed compatibility check. Excluding it from installation.
remote:        [3/4] Linking dependencies...
remote:        warning "admin-lte > tempusdominus-bootstrap-4@5.1.2" has unmet peer dependency "moment-timezone@^0.5.11".
remote:        warning "admin-lte > tempusdominus-bootstrap-4@5.1.2" has unmet peer dependency "tempusdominus-core@5.0.3".
remote:        warning " > webpack-dev-server@3.9.0" has unmet peer dependency "webpack@^4.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:        Done in 45.29s.
remote:        
remote: -----> Build
remote:        
remote: -----> Pruning devDependencies
remote:        yarn install v1.19.1
remote:        [1/4] Resolving packages...
remote:        [2/4] Fetching packages...
remote:        info fsevents@1.2.9: The platform "linux" is incompatible with this module.
remote:        info "fsevents@1.2.9" is an optional dependency and failed compatibility check. Excluding it from installation.
remote:        [3/4] Linking dependencies...
remote:        warning "admin-lte > tempusdominus-bootstrap-4@5.1.2" has unmet peer dependency "moment-timezone@^0.5.11".
remote:        warning "admin-lte > tempusdominus-bootstrap-4@5.1.2" has unmet peer dependency "tempusdominus-core@5.0.3".
remote:        warning " > webpack-dev-server@3.9.0" has unmet peer dependency "webpack@^4.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:        warning Ignored scripts due to flag.
remote:        Done in 7.48s.
remote:        
remote: -----> Caching build
remote:        - node_modules
remote:        
remote: -----> Build succeeded!
remote:  !     This app may not specify any way to start a node process
remote:        https://devcenter.heroku.com/articles/nodejs-support#default-web-process-type
remote: 
remote:  !     Unmet dependencies don't fail yarn install but may cause runtime issues
remote:        https://github.com/npm/npm/issues/7494
remote: 
remote: -----> Discovering process types
remote:        Procfile declares types     -> (none)
remote:        Default types for buildpack -> web
remote: 
remote: -----> Compressing...
remote:        Done: 84.1M
remote: -----> Launching...
remote:        Released v7
remote:        https://desolate-gorge-64361.herokuapp.com/ deployed to Heroku
remote: 
remote: Verifying deploy... done.
To https://git.heroku.com/desolate-gorge-64361.git
   9779d47..d22766a  master -> master

成功した!!
そして地味に create runtime environment が追加されてる!!!
わーい

2
2
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
2