Permission denied scandir /root/npm

I ended up upgrading one of my NodeJS services from 12 to 16 and then I started to get this error on Travis build:

 glob error [Error: EACCES: permission denied, scandir '/root/.npm/_logs'] {
  errno: -13,
  code: 'EACCES',
  syscall: 'scandir',
  path: '/root/.npm/_logs'
}

My .travis.yml file:

language: node_js
node_js:
  - 16

services:
  - docker

cache:
  yarn: true
  directories:
    - node_modules

before_install:
  - curl -o- -L https://yarnpkg.com/install.sh | bash -s
  - export PATH="$HOME/.yarn/bin:$PATH"

before_script:
  - echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin

script:
  - docker-compose run persistence-api npm run test:ci
  - npm run dist

any ideas

Try disabling cache with false values. Remove your before_install Travis hook, seems very recursive reading your code, once you do these things try and start the build again.

1 Like