Skip to content

Node variant: NPM fails with EACCES error when installing package #233

@tkapuranis

Description

@tkapuranis

Describe the bug
npm global install fails with EACCES error when using latest node variant image for python 3.11.

To Reproduce
Install an npm package globally

npm-install:
    resource_class: small
    docker:
      - image: cimg/python:3.11-node
    steps:
      - run:
          name: Install junit-merger
          command: |
            npm install -g junit-report-merger

Results in

npm ERR! code EACCES
npm ERR! syscall mkdir
npm ERR! path /usr/local/lib/node_modules/junit-report-merger
npm ERR! errno -13
npm ERR! Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/junit-report-merger'
npm ERR!  [Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/junit-report-merger'] {
npm ERR!   errno: -13,
npm ERR!   code: 'EACCES',
npm ERR!   syscall: 'mkdir',
npm ERR!   path: '/usr/local/lib/node_modules/junit-report-merger'
npm ERR! }
npm ERR! 
npm ERR! The operation was rejected by your operating system.
npm ERR! It is likely you do not have the permissions to access this file as the current user
npm ERR! 
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator.

npm ERR! A complete log of this run can be found in: /home/circleci/.npm/_logs/2024-03-11T20_27_47_096Z-debug-0.log

Exited with code exit status 243

Expected behavior
Package is installed and available

Workarounds
Explicitly using the previous 3.11 version (cimg/python:3.11.7-node) works as expected

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions