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.lockfile
- Remove the node_modulesfolder
- Run npm install
- Replace all occurrences of yarnwithnpmin your project
Notes
- With npmvendored packages with dependencies create their ownnode_modulesfolder 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.jsonto the fixed version used in youryarn.lock(after the firstnpm installyou 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)