Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Permission denied while restore npm cache #158

Open
lu911 opened this issue Jul 21, 2022 · 9 comments
Open

Permission denied while restore npm cache #158

lu911 opened this issue Jul 21, 2022 · 9 comments
Assignees
Labels
bug Something isn't working

Comments

@lu911
Copy link

lu911 commented Jul 21, 2022

Orb version: 5.0.2

What happened:

Getting "Permission Denied" while restore npm cache.

error:

Found a cache from build 859 at node-deps-arch1-linux-amd64-6_106-v2-develop-XdJ1g_ahUn0RDtSmEalhzFrcTZXR2yOAu+BGa+T52zI=
Size: 61 MiB
Cached paths:
  * /home/circleci/.npm

Downloading cache archive...
Validating cache...

Unarchiving cache...
Skipping writing "home/circleci/.npm/_cacache/content-v2/sha1/04/5f/9782d011ae9a6803ddd382b24392b3d890f7" - open /home/circleci/.npm/_cacache/content-v2/sha1/04/5f/9782d011ae9a6803ddd382b24392b3d890f7: permission denied

config.yml:

version: 2.1
orbs:
  node: circleci/node@5.0.2

jobs:
  deploy:
    working_directory: ~/tmp
    machine:
      image: ubuntu-2004:202201-02
    steps:
      - checkout
      - attach_workspace:
          at: ~/tmp
      - node/install:
          node-version: '14.17.3'
      - node/install-packages:
          override-ci-command: npm install
          cache-version: v3
      - deploy:
          name: Deploy
          command: |
            ...

Expected behavior:

The cache is restored without errors.

Additional Information:

@lu911 lu911 added the bug Something isn't working label Jul 21, 2022
@whanwells
Copy link

This seems to only occur when using a machine image (at least in my experience).

@eaviles
Copy link

eaviles commented Mar 9, 2023

I was having this issue too, in my experience it seems like when using a machine image it sometimes picks up hosts with cached files from other pipeline runs. I got around the issue by deleting the ~/.npm folder before trying to restore the cache…

- run: rm -rf ~/.npm
- node/install-packages

Funny enough, it seems to happen with other tools like nvm. The cache (/opt/circleci/.nvm/.cache) has already a bunch of files when starting the machine.

@whanwells
Copy link

- run: rm -rf ~/.npm
- node/install-packages

This worked for me as well. Thanks for the tip @eaviles!

@KyleTryon
Copy link
Contributor

Hey folks, sorry for the delay. I have replicated the issue and working with the image folks to see what we can do.

@Peter-Darton-i2
Copy link

I ran into this one too. chmod -R u+w ~/.npm sorted it for me.
I wouldn't recommend nuking the folder.

As far as I can tell, this is actually a symptom of flaws in the restore_cache functionality; if that was made to work correctly, this wouldn't be a problem.

@DominicGBauer
Copy link

@KyleTryon has there been any progress on this issue?

@KyleTryon
Copy link
Contributor

This image had been resolved, we should have closed this issue. Are you experiencing this again? Is it also on the machine? @DominicGBauer

@warrenronsiek
Copy link

I'm experiencing this issue with the following:

jobs:
  test:
    docker:
      - image: cimg/node:21.7.1
    steps:
      - checkout
      - restore_cache:
          keys:
            - v1-dependencies-{{ checksum "yarn.lock" }}

the proposed workarounds don't work for me: '/home/circleci/.npm': No such file or directory

@marboledacci
Copy link
Contributor

@warrenronsiek can you provide more details on the issue you have? The exact error, the orb version. The original issue was related to machine executors, so your issue is probably different.

@marboledacci marboledacci self-assigned this Aug 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

8 participants