What happened?
When running pi install <npm-hosted-extension> Pi tries to install the packages globally, and on Linux systems likely fails with access error (trying to install to /usr/lib/node_modules/...:
$ pi install npm:pi-simplify
Installing npm:pi-simplify...
npm error code EACCES
npm error syscall mkdir
npm error path /usr/lib/node_modules/pi-simplify
npm error errno -13
npm error Error: EACCES: permission denied, mkdir '/usr/lib/node_modules/pi-simplify'
npm error at async mkdir (node:internal/fs/promises:1501:10)
npm error at async /usr/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/reify.js:589:20
npm error at async Promise.allSettled (index 0)
npm error at async #reifyPackages (/usr/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/reify.js:321:11)
npm error at async Arborist.reify (/usr/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/reify.js:127:5)
npm error at async Install.exec (/usr/lib/node_modules/npm/lib/commands/install.js:149:5)
npm error at async Npm.exec (/usr/lib/node_modules/npm/lib/npm.js:193:9)
npm error at async module.exports (/usr/lib/node_modules/npm/lib/cli/entry.js:67:5) {
npm error errno: -13,
npm error code: 'EACCES',
npm error syscall: 'mkdir',
npm error path: '/usr/lib/node_modules/pi-simplify'
npm error }
npm error
npm error The operation was rejected by your operating system.
npm error It is likely you do not have the permissions to access this file as the current user
npm error
npm error If you believe this might be a permissions issue, please double-check the permissions of the file and its containing directories, or try running the command again as root/Administrator.
npm error A complete log of this run can be found in: /home/greg/.npm/_logs/2026-05-16T15_37_35_967Z-debug-0.log
Error: npm install -g pi-simplify failed with code 243
The relevant code is here:
|
private async installNpmBatch(specs: string[], scope: InstalledSourceScope): Promise<void> { |
|
if (scope === "user") { |
|
await this.runNpmCommand(["install", "-g", ...specs]); |
|
return; |
|
} |
|
const installRoot = this.getNpmInstallRoot(scope, false); |
|
this.ensureNpmProject(installRoot); |
|
await this.runNpmCommand(["install", ...specs, "--prefix", installRoot]); |
|
} |
Steps to reproduce
- EDIT to add: install the pi-coding-agent on ArchLinux
- on Linux, try to install an
npm module for pi, such as npm:pi-simplify as a normal user, with pi install npm:pi-simplify
- see the access error
Expected behavior
The docs say the extension location is in ~/.pi/agent/extensions/... when things installed on the user level, so pi install installs the extension into the .pi/agent/... folder. Similar stuff with packages are defined as the packages: [...] in ~/.pi/agent/settings.json.
Version
0.74.0
What happened?
When running
pi install <npm-hosted-extension>Pi tries to install the packages globally, and on Linux systems likely fails with access error (trying to install to/usr/lib/node_modules/...:The relevant code is here:
pi/packages/coding-agent/src/core/package-manager.ts
Lines 1116 to 1124 in 87881ca
Steps to reproduce
npmmodule for pi, such asnpm:pi-simplifyas a normal user, withpi install npm:pi-simplifyExpected behavior
The docs say the extension location is in
~/.pi/agent/extensions/...when things installed on the user level, sopi installinstalls the extension into the.pi/agent/...folder. Similar stuff with packages are defined as thepackages: [...]in~/.pi/agent/settings.json.Version
0.74.0