Failed to install with npm on ubuntu.
- Dominant language
- TypeScript
- Stars
- 79.3k
- Forks
- 6.8k
- Avg merge
- 2d 6h
- Merged PRs (30d)
- 41
Description
### Is there an existing issue for this?
- [x] I have searched the existing issues
### OS/Web Information
- Web Browser: NA
- Local OS: Ubuntu 22.04
- Remote OS: NA
- Remote Architecture: NA
- `code-server --version`: 4.96.2
### Steps to Reproduce
1. install dependency
2. run `npm install --loglevel verbose --global code-server`
### Expected
Successful installation.
### Actual
Failed installation.
### Logs
```shell
npm info run argon2@0.31.2 install node_modules/code-server/node_modules/argon2 node-pre-gyp install --fallback-to-build
npm info run argon2@0.31.2 install { code: 0, signal: null }
npm info run code-server@4.96.2 postinstall node_modules/code-server sh ./postinstall.sh
npm info run code-server@4.96.2 postinstall { code: 1, signal: null }
npm verbose stack Error: command failed
npm verbose stack at promiseSpawn (/mnt/data_2/pingyu/tools/node-v20.18.1-linux-x64/lib/node_modules/npm/node_modules/@npmcli/promise-spawn/lib/index.js:22:22)
npm verbose stack at spawnWithShell (/mnt/data_2/pingyu/tools/node-v20.18.1-linux-x64/lib/node_modules/npm/node_modules/@npmcli/promise-spawn/lib/index.js:124:10)
npm verbose stack at promiseSpawn (/mnt/data_2/pingyu/tools/node-v20.18.1-linux-x64/lib/node_modules/npm/node_modules/@npmcli/promise-spawn/lib/index.js:12:12)
npm verbose stack at runScriptPkg (/mnt/data_2/pingyu/tools/node-v20.18.1-linux-x64/lib/node_modules/npm/node_modules/@npmcli/run-script/lib/run-script-pkg.js:77:13)
npm verbose stack at runScript (/mnt/data_2/pingyu/tools/node-v20.18.1-linux-x64/lib/node_modules/npm/node_modules/@npmcli/run-script/lib/run-script.js:9:12)
npm verbose stack at /mnt/data_2/pingyu/tools/node-v20.18.1-linux-x64/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/arborist/rebuild.js:329:17
npm verbose stack at run (/mnt/data_2/pingyu/tools/node-v20.18.1-linux-x64/lib/node_modules/npm/node_modules/promise-call-limit/dist/commonjs/index.js:67:22)
npm verbose stack at /mnt/data_2/pingyu/tools/node-v20.18.1-linux-x64/lib/node_modules/npm/node_modules/promise-call-limit/dist/commonjs/index.js:84:9
npm verbose stack at new Promise ()
npm verbose stack at callLimit (/mnt/data_2/pingyu/tools/node-v20.18.1-linux-x64/lib/node_modules/npm/node_modules/promise-call-limit/dist/commonjs/index.js:35:69)
npm verbose pkgid code-server@4.96.2
npm error code 1
npm error path /mnt/data_2/pingyu/nodejs/node_global/lib/node_modules/code-server
npm error command failed
npm error command sh -c sh ./postinstall.sh
npm error Installing Code dependencies...
npm error User agent: npm/10.8.2 node/v20.18.1 linux x64 workspaces/false
npm error You may not have the required dependencies to build the native modules.
npm error Please see https://github.com/coder/code-server/blob/main/docs/npm.md
npm error npm verbose cli /mnt/data_2/pingyu/tools/node-v20.18.1-linux-x64/bin/node /data_2/pingyu/tools/node-v20.18.1-linux-x64/bin/npm
npm error npm info using npm@10.8.2
npm error npm info using node@v20.18.1
npm error npm verbose title npm install
npm error npm verbose argv "install" "--unsafe-perm" "--omit" "dev"
npm error npm verbose logfile logs-max:10 dir:/data_2/pingyu/nodejs/node_cache/_logs/2024-12-25T15_32_13_644Z-
npm error npm verbose logfile /data_2/pingyu/nodejs/node_cache/_logs/2024-12-25T15_32_13_644Z-debug-0.log
npm error npm http fetch GET 200 https://registry.npmjs.org/@microsoft%2f1ds-core-js 3487ms (cache miss)
npm error npm http fetch GET 200 https://registry.npmjs.org/@microsoft%2f1ds-post-js 2391ms (cache miss)
```
### Screenshot/Video
_No response_
### Does this bug reproduce in native VS Code?
This cannot be tested in native VS Code
### Does this bug reproduce in GitHub Codespaces?
This cannot be tested in GitHub Codespaces
### Are you accessing code-server over a secure context?
- [ ] I am using a secure context.
### Notes
nodejs version: 20.18.1
npm version: 10.8.2
when run `npm config set python python3`, it outputs `npm error `python` is not a valid npm option`.
Contributor guide
Research direction
Start with docs/npm.md and the postinstall.sh entry point named in the log. Reproduce `npm install --loglevel verbose --global code-server` on Ubuntu 22.04 with Node 20.18.1 and npm 10.8.2, then identify why the postinstall step exits with code 1. Done means the documented npm installation completes successfully.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- nodejs
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100