[Rails 6]에서 rails s하면 webpacker에서 오류가 발생했습니다.

rails s 후 오류 메시지에서 webpacker 설치 실행을 읽습니다.



Rails6.1.2.1과 Ruby3라는 최신 버전으로 앱을 만들고,
rails s를 시도하면 즉시 오류를 불었다.
일단 오류 메시지를 따라 가면,
Please run rails webpacker:install
라는 것.
% rails s
=> Booting Puma
=> Rails 6.1.2.1 application starting in development
=> Run `bin/rails server --help` for more startup options
Exiting
/Users/<ユーザー名>/<アプリディレクト>/<アプリ名>/vendor/bundle/ruby/3.0.0/gems/webpacker-5.2.1/lib/webpacker/configuration.rb:99:in `rescue in load': Webpacker configuration file not found /Users/<ユーザー名>/<アプリディレクト>/<アプリ名>/config/webpacker.yml. **Please run rails webpacker:install** Error: No such file or directory @ rb_sysopen - /Users/<ユーザー名>/<アプリディレクト>/<アプリ名>/config/webpacker.yml (RuntimeError)

rails webpacker:install 해보자



모처럼의 힌트이므로 조속히 rails webpacker:install

순조롭게 가면,├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
└─ [email protected]
✨ Done in 14.73s.
Webpacker successfully installed 🎉 🍰

설치되어있어, 행복한 느낌.

도중 오류 메시지는 나중에.



설치 중에 오류 메시지가 나타날 수 있습니다.
이런 것은 지금은 직접 관계는 없지만 잘 좋다는 때도 있습니다.
우선 이번은 잘 자주.Installing all JavaScript dependencies [5.2.1]
run yarn add @rails/[email protected] from "."
yarn add v1.22.10
info No lockfile found.
[1/4] 🔍 Resolving packages...
warning @rails/webpacker > node-sass > [email protected]: request has been deprecated, see https://github.com/request/request/issues/3142
warning @rails/webpacker > node-sass > node-gyp > [email protected]: request has been deprecated, see https://github.com/request/request/issues/3142
warning @rails/webpacker > node-sass > request > [email protected]: this library is no longer supported
warning @rails/webpacker > webpack > watchpack > watchpack-chokidar2 > [email protected]: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.
warning @rails/webpacker > webpack > watchpack > watchpack-chokidar2 > chokidar > [email protected]: fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2.
warning @rails/webpacker > webpack > micromatch > snapdragon > source-map-resolve > [email protected]: https://github.com/lydell/resolve-url#deprecated
warning @rails/webpacker > webpack > micromatch > snapdragon > source-map-resolve > [email protected]: Please see https://github.com/lydell/urix#deprecated
[2/4] 🚚 Fetching packages...
[3/4] 🔗 Linking dependencies...
[4/4] 🔨 Building fresh packages...
[1/3] ⢀ fsevents
[-/3] ⢀ waiting...
**error /Users/<ユーザー名>/<アプリディレクト>/<アプリ名>/node_modules/node-sass: Command failed.
Exit code: 1**
Command: node scripts/build.js
Arguments:
Directory: /Users/<ユーザー名>/<アプリディレクト>/<アプリ名>/node_modules/node-sass
Output:
Building: /usr/local/Cellar/node/15.8.0/bin/node /Users/<ユーザー名>/<アプリディレクト>/<アプリ名>/node_modules/node-gyp/bin/node-gyp.js rebuild --verbose --libsass_ext= --libsass_cflags= --libsass_ldflags= --libsass_library=

yarn과 node 관계로 앞으로 오류를 밟을 것 같습니다.

rails s를 시도



webpaker는 안전하게 설치할 수 있었기 때문에,
rails s 시도.
% rails s
=> Booting Puma
=> Rails 6.1.2.1 application starting in development
=> Run `bin/rails server --help` for more startup options
Puma starting in single mode...
* Puma version: 5.2.1 (ruby 3.0.0-p0) ("Fettisdagsbulle")
* Min threads: 5
* Max threads: 5
* Environment: development
* PID: 3839
* Listening on http://127.0.0.1:3000
* Listening on http://[::1]:3000
Use Ctrl-C to stop
Started GET "/" for ::1 at 2021-02-18 20:24:24 +0900
(6.8ms) SELECT sqlite_version(*)
Processing by Rails::WelcomeController#index as HTML
Rendering vendor/bundle/ruby/3.0.0/gems/railties-6.1.2.1/lib/rails/templates/rails/welcome/index.html.erb
Rendered vendor/bundle/ruby/3.0.0/gems/railties-6.1.2.1/lib/rails/templates/rails/welcome/index.html.erb (Duration: 16.7ms | Allocations: 525)
Completed 200 OK in 78ms (Views: 35.7ms | ActiveRecord: 0.0ms | Allocations: 6869)


이것으로 마침내 시작 지점입니다!

오류 메시지는 친구



오류 메시지에서 힌트는 많다.
오류와 버그는 적이지만,
오류 메시지는 친구가되고 싶습니다.

4아 아빠 블로그

좋은 웹페이지 즐겨찾기