Search code examples
ruby-on-railsyarnpkg

Yarn packages won't update for dependency issue


On a development server, for an application barely deployed, rails commands won't execute because of lack of integrity file.

error Couldn't find an integrity file
error Found 1 errors.


========================================
  Your Yarn packages are out of date!
  Please run `yarn install --check-files` to update.
========================================

Both

yarn install --check-files
yarn install

lead to the same error

compression-webpack-plugin@4.0.1: The engine "node" is incompatible with this module. Expected version ">= 10.13.0". Got "8.17.0"
Found incompatible module
 Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.

The 'visit' prompt is unfortunately of no use, as it does not deal with the node engine.

Being barely deployed, there is no node-modules directory yet, which is expected. However on development machine there is the directory and no issues whatseoever in precompiling assets.
Server context:

node -v
> v8.17.0

How can this situation be unblocked?


Solution

  • you need to update the node to a version higher than the one mentioned >= 10.13.0 then re-install yarn and re-run the check:

    if you're on Mac OS:

    brew install node@14 && brew link --force node@14
    brew install yarn
    

    if you're on Linux:

    cd ~
    curl -sL https://deb.nodesource.com/setup_14.x -o nodesource_setup.sh
    sudo bash nodesource_setup.sh
    sudo apt install nodejs
    

    then check if you have a compatible version

    node -v
    => v14.2.0
    ``
    
    if so re-run any of your commands:
    
    ```bash
    yarn install --check-files
    yarn install