Skip to content

Permission denied error when trying to install pnpm via Corepack as node user #1732

@bgondy

Description

@bgondy

Environment

  • Node.js Version: 16.15.0
  • Image Tag: lts-alpine

Expected Behavior

I should be able to install pnpm using Corepack as a non-privilegied user.

Current Behavior

When I try to install pnpm via Corepack (corepack enable) as non-privilegied user (-u node), I get the following error:

/app $ corepack enable
Internal Error: EACCES: permission denied, symlink '../lib/node_modules/corepack/dist/pnpm.js' -> '/usr/local/bin/pnpm'
Error: EACCES: permission denied, symlink '../lib/node_modules/corepack/dist/pnpm.js' -> '/usr/local/bin/pnpm'
/app $ 

Running corepack enable as root work as expected.

docker run -it -v $(pwd):/app node:lts-alpine /bin/sh

image

Steps to Reproduce

  1. Create an empty project with the following package.json. The packageManager property is important here.

    {
        "name": "docker-node-pnpm",
        "version": "1.0.0",
        "private": true,
        "packageManager": "pnpm@7.1.7"
    }
  2. Run the container as a non-privilegied user: docker run -it -v $(pwd):/app -u node node:lts-alpine /bin/sh

  3. cd /app

  4. corepack enable <-- This should fail

  5. corepack prepare

  6. pnpm install

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions