Ruby on rails RubyonRails 6+;Docker=Webpacker::Manifest::MissingEntryError?
尝试将my Rails应用程序作为Docker容器运行,但在打开页面时出现以下错误:Ruby on rails RubyonRails 6+;Docker=Webpacker::Manifest::MissingEntryError?,ruby-on-rails,webpack,webpack-dev-server,webpacker,ruby-on-rails-6,Ruby On Rails,Webpack,Webpack Dev Server,Webpacker,Ruby On Rails 6,尝试将my Rails应用程序作为Docker容器运行,但在打开页面时出现以下错误: Webpacker can't find application in /app/public/packs/manifest.json. Possible causes: 1. You want to set webpacker.yml value of compile to true for your environment unless you are using the `webpack -w` o
Webpacker can't find application in /app/public/packs/manifest.json. Possible causes:
1. You want to set webpacker.yml value of compile to true for your environment
unless you are using the `webpack -w` or the webpack-dev-server.
2. webpack has not yet re-run to reflect updates.
3. You have misconfigured Webpacker's config/webpacker.yml file.
4. Your webpack configuration is not creating a manifest.
Your manifest contains:
{
}
当我使用rails s运行应用程序时,它运行得很好,并且创建了public/packs文件夹。
在日志中还有
/usr/local/bundle/gems/webpacker-4.2.0/lib/webpacker/runner.rb:13:in ``': No such file or directory - yarn (Errno::ENOENT)
错误,尽管我检查了容器纱线-v显示已安装纱线
Dockerfile
FROM ruby:2.6.3
RUN apt-get update -qq \
&& curl -sL https://deb.nodesource.com/setup_12.x | bash - \
&& apt-get install -y nodejs \
&& curl -o- -L https://yarnpkg.com/install.sh | bash
RUN mkdir /app
WORKDIR /app
COPY Gemfile /app/Gemfile
COPY Gemfile.lock /app/Gemfile.lock
RUN bundle install
COPY . /app
# Add a script to be executed every time the container starts.
COPY entrypoint.sh /usr/bin/
RUN chmod +x /usr/bin/entrypoint.sh
ENTRYPOINT ["entrypoint.sh"]
EXPOSE 3000
# Start the main process.
CMD ["rails", "server", "-b", "0.0.0.0"]
docker-compose.yml
version: '3'
services:
webpacker:
build: .
env_file:
- '.env.docker'
command: ./bin/webpack-dev-server
volumes:
- .:/app
ports:
- '3035:3035'
web:
build: .
command: bash -c "rm -f tmp/pids/server.pid && bundle exec rails s -p 3000 -b '0.0.0.0'"
volumes:
- .:/app
ports:
- "3000:3000"
环境署署长
NODE_ENV=development
RAILS_ENV=development
WEBPACKER_DEV_SERVER_HOST=0.0.0.0
按照以下步骤操作 i) docker compose
run{rails\u app\u name}
然后再次使用
ii)docker compose build{rails\u app\u name}
iii)docker-compose-up
参考:
[1] :更新:我可以使用
docker exec-it sitemap\u web\u 1 bash-lc./bin/webpack dev server”
通过登录shell手动启动webpack dev server。看起来问题的根源在于环境的可视性你有没有弄明白这一点?现在用Rails 6.0.3和19.03.8来处理这个问题