An error that occurred when installing node_module in Rails environment.
========================================
Your Yarn packages are out of date!
Please run `yarn install --check-files` to update.
========================================
To disable this check, please change `check_yarn_integrity`
to `false` in your webpacker config file (config/webpacker.yml).
yarn check v1.22.5
info Visit https://yarnpkg.com/en/docs/cli/check for documentation about this command.
This error is displayed if the version and hash value of the package content in package.json ** does not match the one listed in yarn.lock **. In other words, you just have to match the versions of what is described in package.json and yarn.lock.
yarn upgrade
# package.Update dependencies to the latest version based on the version range specified in json.
$ yarn upgrade
Comparing package.json and yarn.lock,
--In package.json, specify to download 2.X.X (at that time, 2.7.3 was the latest version)
--In yarn.lock, package.json specifies ^ 2.7.3
, so 2.9.4 is downloaded.
package.json
"dependencies": {
"chart.js": "^2.7.3"
}
yarn.lock
chart.js@^2.7.3:
version "2.9.4"
resolved "https://registry.yarnpkg.com/chart.js/-/chart.js-2.9.4.tgz#0827f9563faffb2dc5c06562f8eb10337d5b9684"
integrity sha512-B07aAzxcrikjAPyV+01j7BmOpxtQETxTSlQ26BEYJ+3iUkbNKaOJ/nDbT6JjyqYxseM0ON12COHYdU2cTIjC7A==
dependencies:
chartjs-color "^2.1.0"
moment "^2.10.2"
Therefore, specify the version of package.json in the same way as that of yarn.lock.
$ yarn upgrade chart.js@^2.9.4
"dependencies": {
- "chart.js": "^2.7.3"
+ "chart.js": "^2.9.4"
}
$ rails s
=> Booting Puma
=> Rails 6.X.X application starting in development
=> Run `rails server --help` for more startup options
[1] Puma starting in cluster mode...
[1] * Version 4.3.7 (ruby 2.X.X-p137), codename: Mysterious Traveller
[1] * Min threads: 5, max threads: 5
[1] * Environment: development
[1] * Process workers: 1
[1] * Preloading application
[1] * Listening on tcp://0.0.0.0:3000
[1] Use Ctrl-C to stop
[1] - Worker 0 (pid: 81) booted, phase: 0
I don't know why it was solved, but if you are using Docker The above method did not solve the problem, but in some cases it was solved by deleting the Docker process and rebuilding it.
$ docker rm (docker ps -q -a) #Delete all containers
$ docker-compose up
Recommended Posts