Rails 6 本地服务器启动:RAILS_ENV=未定义开发环境

Rails 6 local server booting : RAILS_ENV=development environment is not defined

我刚刚创建了一个新的 Rails 6 应用程序。一切顺利,直到我尝试使用 rails s 启动本地服务器并收到此错误消息:

RAILS_ENV=development environment is not defined in config/webpacker.yml, falling back to production environment
Exiting

Webpacker configuration file not found /Users/remy/dev/voter/config/webpacker.yml. Please run rails webpacker:install Error: No such file or directory @ rb_sysopen - /Users/remy/dev/voter/config/webpacker.yml (RuntimeError)

但是当我运行rails webpacker:install的时候还是报错

该错误通常暗示未满足 Yarn 依赖项。尝试在 运行 rails webpacker:install.

之前安装或更新 Yarn

这里有 Yarn Docs 以供快速参考。