gpt4 book ai didi

webpack - ActionView::Template::Error: Webpacker 使用 ci/cd autodevops 部署到 Gitlab 时,在/app/public/packs/manifest.json 中找不到应用程序

转载 作者:行者123 更新时间:2023-12-04 09:15:03 24 4
gpt4 key购买 nike

它在本地完美运行,但在部署到 Gitlab 时在测试阶段使用 CI/CD 运行的管道期间收到此错误:

Webpacker::Manifest::MissingEntryError: 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:
{
}

Here are few lines from the application.html file:

<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %>
<%= javascript_pack_tag 'application', 'data-turbolinks-track': 'reload' %>

and my stylesheets are .scss files and there's no .css file in the project.

This is my webpacker.yml :

default: &default
source_path: app/javascript
source_entry_path: packs
public_root_path: public
public_output_path: packs
cache_path: tmp/cache/webpacker
check_yarn_integrity: false
webpack_compile_output: true

# Additional paths webpack should lookup modules
# ['app/assets', 'engine/foo/app/assets']
resolved_paths: [ ]

# Reload manifest.json on all requests so we reload latest compiled packs
cache_manifest: false

# Extract and emit a css file
extract_css: true

static_assets_extensions:
- .jpg
- .jpeg
- .png
- .gif
- .tiff
- .ico
- .svg
- .eot
- .otf
- .ttf
- .woff
- .woff2

extensions:
- .mjs
- .js
- .sass
- .scss
- .css
- .module.sass
- .module.scss
- .module.css
- .png
- .svg
- .gif
- .jpeg
- .jpg

development:
<<: *default
compile: true

# Verifies that correct packages and versions are installed by inspecting package.json, yarn.lock, and node_modules
check_yarn_integrity: true

# Reference: https://webpack.js.org/configuration/dev-server/
dev_server:
https: false
host: localhost
port: 3035
public: localhost:3035
hmr: false
# Inline should be set to true if using HMR
inline: true
overlay: true
compress: true
disable_host_check: true
use_local_ip: false
quiet: false
pretty: false
headers:
"Access-Control-Allow-Origin": "*"
watch_options:
ignored: "**/node_modules/**"

test:
<<: *default
compile: true

# Compile test packs to a separate directory
public_output_path: packs-test

production:
<<: *default

# Production depends on the precompilation of packs prior to booting for performance.
compile: false

# Extract and emit a css file
extract_css: true

# Cache manifest.json for performance
cache_manifest: true

Am I missing anything?

最佳答案

为方便解决;
创建 app/javascript/stylesheets文件夹并在该文件夹中添加空 application.scss文件
打开后app/javascript/packs/application.js文件并将添加的文件导入到您的包 js 文件中;

import '../stylesheets/application';
让 webpacker 再次编译所有带有 css/scss 文件的文件。

关于webpack - ActionView::Template::Error: Webpacker 使用 ci/cd autodevops 部署到 Gitlab 时,在/app/public/packs/manifest.json 中找不到应用程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63263890/

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