We recently migrated a Rails application from yarn
to npm
. We decided to go this step instead of upgrading to > Yarn 2.0 to reduce the number of dependencies in our project.
Migration
- Remove the
yarn.lock
file - Remove the
node_modules
folder - Run
npm install
- Replace all occurrences of
yarn
withnpm
in your project
Notes
- With
npm
vendored packages with dependencies create their ownnode_modules
folder within the vendor path. We fixed this by replacing the vendored packages and removing them. - It might be useful to keep the same package versions. You can try
https://github.com/imsnif/synp
Show archive.org snapshot
or change the version constraint in your
package.json
to the fixed version used in youryarn.lock
(after the firstnpm install
you can relax the constraints again). - jsbundling-rails Show archive.org snapshot supports NPM since v1.2.2.
- geordi Show archive.org snapshot supports package managers other than yarn since v11.1.0.
Posted by Katrin to makandra dev (2024-11-20 13:58)