web-dev-qa-db-ja.com

Webpackerがアプリケーションを見つけられない

「Railsの概要」に従って、新しいRailsアプリケーションを作成しています。アプリケーションはステップ4.1で正常に起動します。しかし、最初のコントローラーを作成すると、webpackエラーが発生します。

私はwebpackの初心者ですが、すべてのドキュメントが赤ですが、何が問題なのか、何が欠けているのかわかりません...

  • ウィンドウズ10 1903
  • Ruby 2.6
  • Rails 6.0.0
  • nodeJS 12.11.0

Rails webpacker:install
   identical  config/webpacker.yml
Copying webpack core config
       exist  config/webpack
   identical  config/webpack/development.js
   identical  config/webpack/environment.js
   identical  config/webpack/production.js
   identical  config/webpack/test.js
Copying postcss.config.js to app root directory
   identical  postcss.config.js
Copying babel.config.js to app root directory
   identical  babel.config.js
Copying .browserslistrc to app root directory
   identical  .browserslistrc
The JavaScript app source directory already exists
       apply  C:/Ruby26-x64/lib/Ruby/gems/2.6.0/gems/webpacker-4.0.7/lib/install/binstubs.rb
  Copying binstubs
       exist    bin
   identical    bin/webpack
   identical    bin/webpack-dev-server
      append  .gitignore
Installing all JavaScript dependencies [4.0.7]
         run  yarn add @Rails/webpacker from "."
yarn add v1.17.3
[1/4] Resolving packages...
[2/4] Fetching packages...
info [email protected]: The platform "win32" is incompatible with this module.
info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
warning " > [email protected]" has unmet peer dependency "webpack@^4.0.0".
warning "webpack-dev-server > [email protected]" has unmet peer dependency "webpack@^4.0.0".
[4/4] Building fresh packages...
success Saved 1 new dependency.
info Direct dependencies
└─ @Rails/[email protected]
info All dependencies
└─ @Rails/[email protected]
Done in 4.48s.
Installing dev server for live reloading
         run  yarn add --dev webpack-dev-server from "."
yarn add v1.17.3
[1/4] Resolving packages...
[2/4] Fetching packages...
info [email protected]: The platform "win32" is incompatible with this module.
info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
warning "webpack-dev-server > [email protected]" has unmet peer dependency "webpack@^4.0.0".
warning " > [email protected]" has unmet peer dependency "webpack@^4.0.0".
[4/4] Building fresh packages...
success Saved 1 new dependency.
info Direct dependencies
└─ [email protected]
info All dependencies
└─ [email protected]
Done in 4.92s.
Webpacker successfully installed �????????????

Webpacker::Manifest::MissingEntryError in Welcome#index

Showing C:/Users/[...]/site_test/app/views/layouts/application.html.erb where line #9 raised:

Webpacker can't find application in C:/Users/[...]/site_test/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:
{
}

Extracted source (around line #9):

7
8      <%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %>
9      <%= javascript_pack_tag 'application', 'data-turbolinks-track': 'reload' %>
10 </head>
11 <body>
12
4
Robin Des Bois

ご協力いただきありがとうございます。残念ながら何も機能しません。

Railsの資産:clobberは、node_modulesフォルダーを削除した直後に「整合性ファイルが見つかりませんでした」というエラーを返します。 (yarn install --check-filesの後に機能します)。

およびRails assets:precompile return "C:/Ruby26-x64/lib/Ruby/gems/2.6.0/gems/webpacker-4.0.7/lib/webpacker/webpack_runner.rb:23 : `exec '内:そのようなファイルまたはディレクトリはありません-C:\ Users [...]\site_test\node_modules.bin/webpack(Errno :: ENOENT)"

しかし、私は何が間違っているのかを発見しました:私のコンピューターの場所!おそらく名前の問題...

0
Robin Des Bois