Farid Garciayala
Farid Garciayala

Reputation: 368

EXDEV: cross-device link not permitted, rename '/usr/local/lib/node_modules/npm' -> '/usr/local/lib/node_modules/.npm-i9nnxROI'

My builds keep failing on CircleCI with the error:

EXDEV: cross-device link not permitted, rename '/usr/local/lib/node_modules/npm' -> '/usr/local/lib/node_modules/.npm-i9nnxROI'

This happens before installing any library. Has anyone encountered this problem?

Upvotes: 7

Views: 3629

Answers (3)

morrigannn
morrigannn

Reputation: 69

In my case the reason for this and also some other errors was the release of node 15 and its use in FROM node:alpine -> downgrading to FROM node:14.14.0-alpine worked like a charm

Upvotes: 5

bmaupin
bmaupin

Reputation: 16005

As others have mentioned somehow this seems to be related to using Node 15. In my case I was using the latest Node docker image in my .circleci/config.yml:

jobs:
  build:
    docker:
      - image: circleci/node:latest

The other answers so far have suggested hardcoding a specific node version but I'm generally wary of hardcoding. As an alternative I decided to use the most recent LTS version of Node:

      - image: circleci/node:lts

This fixes the issue and I think it's probably better since it should give me a more stable release to test against moving forward.

Upvotes: 2

Martin Kravec
Martin Kravec

Reputation: 312

Had the same problem when trying to update npm using

npm install -g npm@latest

I decided to use Node Version Manager instead, so that I can set the node version as I need and its also only working solution for me.

My configuration looks like this:

version: 2.1
jobs:
  build:
    docker:
      - image: 'circleci/node:latest'
    environment:
      NODE_VERSION: v12.18.1
    steps:
      - checkout
      - run:
          name: set node version
          command: |
            set +e             
            touch $BASH_ENV  
            curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.36.0/install.sh | bash
            echo 'export NVM_DIR="$HOME/.nvm"' >> $BASH_ENV
            echo '[ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh"' >> $BASH_ENV
            echo 'nvm install $NODE_VERSION' >> $BASH_ENV
            echo 'nvm alias default $NODE_VERSION' >> $BASH_ENV
      - run:
          name: npm install project dependencies
          command:
            npm install
      - run:
          name: lint
          command:
            npm run lint

Upvotes: -1

Related Questions