gpt4 book ai didi

ruby-on-rails - webpacker 在 Rails 4.2 上安装不成功

转载 作者:太空宇宙 更新时间:2023-11-04 00:15:11 27 4
gpt4 key购买 nike

终端:Windows 10 上 Ubuntu 上的 bash rails :4.2.8npm:5.5.1 Node :v8.9.1 yarn :1.3.2

rake webpacker:install后,控制台显示如下。虽然最后显示“安装成功”,但日志中出现了一些错误。正常吗?

  create  config/webpacker.yml
Copying webpack core config and loaders
create config/webpack
create config/webpack/development.js
create config/webpack/environment.js
create config/webpack/production.js
create config/webpack/test.js
Copying .postcssrc.yml to app root directory
create .postcssrc.yml
Copying .babelrc to app root directory
create .babelrc
Creating javascript app source directory
exist app/javascript
identical app/javascript/packs/application.js
Installing binstubs
run bundle binstubs webpacker from "."
append .gitignore
Installing all JavaScript dependencies
run yarn add @rails/webpacker coffeescript@1.12.7 from "."
yarn add v1.3.2
info No lockfile found.
[1/4] Resolving packages...
[2/4] Fetching packages...
info fsevents@1.1.3: The platform "linux" is incompatible with this module.
info "fsevents@1.1.3" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
warning "@rails/webpacker > postcss-cssnext@3.0.2" has unmet peer dependency "caniuse-lite@^1.0.30000697".
error An unexpected error occurred: "EINVAL: invalid argument, lstat '/mnt/d/Github/cfegame/node_modules/babel-core/package-lock.json'".
info If you think this is a bug, please open a bug report with the information provided in "/mnt/d/Github/cfegame/yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.
Installing dev server for live reloading
run yarn add --dev webpack-dev-server from "."
yarn add v1.3.2
info No lockfile found.
[1/4] Resolving packages...
[2/4] Fetching packages...
info fsevents@1.1.3: The platform "linux" is incompatible with this module.
info "fsevents@1.1.3" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
warning "webpack-dev-server > webpack-dev-middleware@1.12.1" has unmet peer dependency "webpack@^1.0.0 || ^2.0.0 || ^3.0.0".
warning " > webpack-dev-server@2.9.4" has unmet peer dependency "webpack@^2.2.0 || ^3.0.0".
error An unexpected error occurred: "EINVAL: invalid argument, lstat '/mnt/d/Github/cfegame/node_modules/camelcase-keys/node_modules/camelcase/license'".
info If you think this is a bug, please open a bug report with the information provided in "/mnt/d/Github/cfegame/yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.
Webpacker successfully installed 🎉 🍰

当我“成功安装”webpacker并想检查webpack-dev-server是否正常工作时,控制台显示如下。这是否意味着我没有正确安装 webpacker?

(home_dir)/.rvm/gems/ruby-2.3.3/gems/webpacker-3.0.2/lib/webpacker/dev_server_runner.rb:47:in `exec': No such file or directory - (project_dir)/node_modules/.bin/webpack-dev-server (Errno::ENOENT)
from (home_dir)/.rvm/gems/ruby-2.3.3/gems/webpacker-3.0.2/lib/webpacker/dev_server_runner.rb:47:in `block in execute_cmd'
from (home_dir)/.rvm/gems/ruby-2.3.3/gems/webpacker-3.0.2/lib/webpacker/dev_server_runner.rb:46:in `chdir'
from (home_dir)/.rvm/gems/ruby-2.3.3/gems/webpacker-3.0.2/lib/webpacker/dev_server_runner.rb:46:in `execute_cmd'
from (home_dir)/.rvm/gems/ruby-2.3.3/gems/webpacker-3.0.2/lib/webpacker/dev_server_runner.rb:11:in `run'
from (home_dir)/.rvm/gems/ruby-2.3.3/gems/webpacker-3.0.2/lib/webpacker/runner.rb:6:in `run'
from (home_dir)/.rvm/gems/ruby-2.3.3/gems/webpacker-3.0.2/exe/webpack-dev-server:8:in `<top (required)>'
from bin/webpack-dev-server:17:in `load'
from bin/webpack-dev-server:17:in `<main>'

最佳答案

基本上,yarn 正在管理您的包。他尝试使用 yarn add --dev webpack-dev-server from "." 安装 webpack-dev-server- 但失败了。这是关于 yarn add command 的文档

npm 是使用 yarn 安装软件包的替代方法,因此在服务器终端中运行

npm install webpack-dev-server

它应该安装依赖项

When I "successfully installed" webpacker and I want to check if webpack-dev-server worked properly, the console shows as follows. Did it mean I don't install webpacker properly?

(home_dir)/.rvm/gems/ruby-2.3.3/gems/webpacker-3.0.2/lib/webpacker/dev_server_runner.rb:47:in `exec': No such file or directory - (project_dir)/node_modules/.bin/webpack-dev-server (Errno::ENOENT)

您要么没有安装它,要么您正在搜索错误的路径,也许gem安装在.rvm/gems/ruby-2.3.3somethingelse

您可能想阅读的一些讨论

https://github.com/Microsoft/WSL/issues/2448

https://github.com/yarnpkg/yarn/issues/4188

关于ruby-on-rails - webpacker 在 Rails 4.2 上安装不成功,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/47502854/

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