gpt4 book ai didi

ruby-on-rails - 在 Rails 5 上使用 webpacker 时,Travis 的必要设置是什么?

转载 作者:行者123 更新时间:2023-12-04 07:39:00 24 4
gpt4 key购买 nike

我是第一次使用travis,不知道如何正确添加webpacker?

这是我现在在 .travis.yml 中拥有的内容

language: ruby

rvm:
- 2.4.4

addons:
postgresql: "9.4"

before_install:
- "echo 'gem: --no-document' > ~/.gemrc"
- "echo '--colour' > ~/.rspec"
- export DISPLAY=:99.0
- sh -e /etc/init.d/xvfb start

before_script:
- bundle exec rake db:create db:migrate RAILS_ENV=test
- bundle exec rails webpacker:compile

这是构建错误

 $ bundle exec rails webpacker:compile
Webpacker is installed 🎉 🍰
Using /home/travis/build/bill/ivan/config/webpacker.yml file for setting up webpack paths
Compiling…
Compilation failed:
/home/travis/build/bill/ivan/vendor/bundle/ruby/2.4.0/gems/webpacker-3.5.5/lib/webpacker/webpack_runner.rb:11:in `exec': No such file or directory - /home/travis/build/bill/ivan/node_modules/.bin/webpack (Errno::ENOENT)
from /home/travis/build/bill/ivan/vendor/bundle/ruby/2.4.0/gems/webpacker-3.5.5/lib/webpacker/webpack_runner.rb:11:in `block in run'
from /home/travis/build/bill/ivan/vendor/bundle/ruby/2.4.0/gems/webpacker-3.5.5/lib/webpacker/webpack_runner.rb:10:in `chdir'
from /home/travis/build/bill/ivan/vendor/bundle/ruby/2.4.0/gems/webpacker-3.5.5/lib/webpacker/webpack_runner.rb:10:in `run'
from /home/travis/build/bill/ivan/vendor/bundle/ruby/2.4.0/gems/webpacker-3.5.5/lib/webpacker/runner.rb:6:in `run'
from ./bin/webpack:15:in `<main>'
The command "bundle exec rails webpacker:compile" failed and exited with 1 during .
Your build has been stopped.

没有这样的文件或目录 -/home/travis/build/bill/ivan/node_modules/.bin/webpack (Errno::ENOENT)它在我的 Rails 应用程序中

最佳答案

也许它可以帮助其他人:所以这里的设置终于可以工作了

language: ruby

rvm:
- 2.4.4

addons:
postgresql: "9.4"

before_install:
- "echo 'gem: --no-document' > ~/.gemrc"
- "echo '--colour' > ~/.rspec"
- export DISPLAY=:99.0
- sh -e /etc/init.d/xvfb start

before_script:
- bundle exec rake db:create db:migrate RAILS_ENV=test

cache:
bundler: true
directories:
- node_modules
yarn: true

install:
- bundle install
- nvm install node
- node -v
- npm i -g yarn
- yarn

script:
- bundle exec rails webpacker:compile
- bundle exec rails spec

关于ruby-on-rails - 在 Rails 5 上使用 webpacker 时,Travis 的必要设置是什么?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52368188/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com