Home#index中的Webpacker :: Manifest :: MissingEntryError 显示/Users/khalidhosein/Desktop/myEPKmedia/builder/khalid101/app/views/layouts/embedded_app.html.erb,其中第7行出现:
Webpacker can't find hello_react.js in /Users/khalidhosein/Desktop/myEPKmedia/builder/khalid101/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:
{
"application.js": "/packs/application-68dcba18197451fbb79e.js",
"application.js.map": "/packs/application-68dcba18197451fbb79e.js.map"
}
Extracted source (around line #7):
5
6
7
8
9
10
<% application_name = ShopifyApp.configuration.application_name %>
<title><%= application_name %></title>
<%= javascript_pack_tag 'hello_react' %>
<%= stylesheet_link_tag 'application' %>
<%= javascript_include_tag 'application', "data-turbolinks-track" => true %>
<%= csrf_meta_tags %>
Rails.root: /Users/khalidhosein/Desktop/myEPKmedia/builder/khalid101
Application Trace | Framework Trace | Full Trace
app/views/layouts/embedded_app.html.erb:7:in `_app_views_layouts_embedded_app_html_erb___4509380428416253144_70127991029820'
Request
Parameters:
None
尝试将我的Rails应用程序与React前端连接时出现此错误。我尝试研究和重新配置所有来源的文件。我还重新创建了manifiedt.json文件并打包了库。我正在关注本教程:
https://github.com/natemacinnes/natemacinnes.github.io/blob/master/rails-5-shopify-app-setup.md
如果有人有任何想法,将不胜感激,因为那里没有太多的文档或教程来介绍如何将Rails Shopify API与React连接起来。
我的密码----> https://github.com/KhalidH82/ShopifyApp-React-Rails
答案 0 :(得分:4)
可能是您错过了安装npm install
的原因。我遇到了您提到的完全相同的问题。只需在您的终端或npm install
中输入Dockerfile
。我希望这个问题能得到解决。
$ npm install
答案 1 :(得分:0)
尽管我没有使用react,但是在新创建的Rails 6应用程序上遇到了相同的错误。重新安装webpacker为我修复了该问题:
bundle exec rake webpacker:install
我想可能是缺少一些依赖关系,或者是旧版本中的错误(我注意到webpack-dev-server
版本已升级到3.8.1
)。
答案 2 :(得分:0)
尝试在 Ubuntu 20.04 中建立新的 Rails 6 应用程序时,我遇到了同样的挑战。
当我启动Rails服务器并转到浏览器时,出现错误消息:
Webpacker::Manifest::MissingEntryError in Books#index
Showing /home/promisepreston/dynamic_authorization/app/views/layouts/application.html.erb where line #9 raised:
Webpacker can't find application in /home/promisepreston/dynamic_authorization/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 6 应用程序中设置webpacker
。从 Rails 6 开始,webpacker
是默认的JavaScript编译器。这意味着所有JavaScript代码将由webpacker
处理,而不是由旧资产管道(也称为sprockets
)处理。
要在Rails 6应用程序中安装webpacker
,只需运行以下命令:
bundle exec rails webpacker:install
OR
rails webpacker:install
这应该成功安装webpacker
及其所有依赖项。
仅此而已。
我希望这会有所帮助
答案 3 :(得分:0)
更新到 Rails 5.1 和 Webpacker 5.x 后我遇到了同样的错误
https://github.com/rails/webpacker/blob/5-x-stable/docs/integrations.md#react
现在的命令是
bundle exec rails webpacker:install:react
答案 4 :(得分:0)
我在重新安装 webpacker 的新应用程序上遇到了同样的错误。
rails webpacker:install
答案 5 :(得分:0)
在尝试了这么多不同的解决方案后,这奏效了!
yarn config set registry https://registry.npmjs.org
rm yarn.lock
yarn
然后再次安装 webpack
bundle exec rails webpacker:install