工头开始开发失败 rails

foreman start failed on development rails

我按照 webpack-rails gem 文档步骤在我的 rails 应用程序上安装了 webpacker。

一旦我 运行 bundle exec rails generate webpack_rails:install 生成了所有文件并且 foreman 被添加到 gem 文件中。然后我又做了 bundle install。之后我做了

foreman start 如文档中所述。

然后我得到了这个错误。

18:54:56 rails.1   | started with pid 19096
18:54:56 webpack.1 | started with pid 19097
18:54:56 webpack.1 | /home/desmond/.rvm/gems/ruby-2.3.4/gems/foreman-0.64.0/bin/foreman-runner: 41: exec: ./node_modules/.bin/webpack-dev-server: not found
18:54:56 webpack.1 | exited with code 127
18:54:56 system    | sending SIGTERM to all processes
18:54:56 rails.1   | terminated by SIGTERM

我在这里看到了类似的问题,但没有答案。

这个gem指的是yarn用于捆绑节点包(你也可以直接使用npm)。根据 gem tough, you need to install yarn 然后你需要 运行

`yarn install` 

(自述文件中缺少此步骤)实际安装使用 webpack 所需的节点模块。

yarn cli