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

[BUG] run npm install failed,return errno -32 #6192

Closed
2 tasks done
kycheng opened this issue Feb 23, 2023 · 1 comment
Closed
2 tasks done

[BUG] run npm install failed,return errno -32 #6192

kycheng opened this issue Feb 23, 2023 · 1 comment
Labels
Bug thing that needs fixing Needs Triage needs review for next steps Release 8.x work is associated with a specific npm 8 release

Comments

@kycheng
Copy link

kycheng commented Feb 23, 2023

Is there an existing issue for this?

  • I have searched the existing issues

This issue exists in the latest npm version

  • I am using the latest npm

Current Behavior

use the proxy library configured by nexus, run npm install. It will fail in most cases. The log is as follows:

+ npm install --verbose
npm verb cli /usr/local/bin/node /usr/local/bin/npm
npm info using npm@8.19.2
npm info using node@v18.12.1
npm timing npm:load:whichnode Completed in 1ms
npm timing config:load:defaults Completed in 2ms
npm timing config:load:file:/usr/local/lib/node_modules/npm/npmrc Completed in 1ms
npm timing config:load:builtin Completed in 2ms
npm timing config:load:cli Completed in 2ms
npm timing config:load:env Completed in 1ms
npm timing config:load:file:/workspace/source/.npmrc Completed in 1ms
npm timing config:load:project Completed in 10ms
npm timing config:load:file:/root/.npmrc Completed in 2ms
npm timing config:load:user Completed in 2ms
npm timing config:load:file:/usr/local/etc/npmrc Completed in 0ms
npm timing config:load:global Completed in 0ms
npm timing config:load:validate Completed in 1ms
npm timing config:load:credentials Completed in 1ms
npm timing config:load:setEnvs Completed in 1ms
npm timing config:load Completed in 23ms
npm timing npm:load:configload Completed in 23ms
npm timing npm:load:mkdirpcache Completed in 1ms
npm timing npm:load:mkdirplogs Completed in 1ms
npm verb title npm install
npm verb argv "install" "--loglevel" "verbose"
npm timing npm:load:setTitle Completed in 1ms
npm timing config:load:flatten Completed in 3ms
npm timing npm:load:display Completed in 7ms
npm verb logfile logs-max:10 dir:/root/.npm/_logs
npm verb logfile /root/.npm/_logs/2023-02-23T08_38_00_546Z-debug-0.log
npm timing npm:load:logFile Completed in 7ms
npm timing npm:load:timers Completed in 0ms
npm timing npm:load:configScope Completed in 0ms
npm timing npm:load Completed in 42ms
npm timing arborist:ctor Completed in 1ms
npm timing idealTree:init Completed in 805ms
npm timing idealTree:userRequests Completed in 0ms
npm http fetch GET 200 http://nexus.proxy/repository/npmtao/nyc 74ms (cache miss)
npm http fetch GET 200 http://nexus.proxy/repository/npmtao/caching-transform 76ms (cache miss)
...
npm timing idealTree:buildDeps Completed in 526ms
npm timing idealTree:fixDepFlags Completed in 9ms
npm timing idealTree Completed in 1353ms
npm timing reify:loadTrees Completed in 1355ms
npm timing reify:diffTrees Completed in 20ms
npm timing reify:retireShallow Completed in 1ms
npm timing reify:createSparse Completed in 1000ms
npm timing reify:loadBundles Completed in 0ms
npm verb reify failed optional dependency /workspace/source/node_modules/fsevents
npm timing reifyNode:node_modules/fsevents Completed in 146ms
npm http fetch POST 404 http://nexus.proxy/repository/npmtao/-/npm/v1/security/advisories/bulk 273ms
npm http fetch POST 400 http://nexus.proxy/repository/npmtao/-/npm/v1/security/audits/quick 87ms
npm verb audit error HttpErrorGeneral: 400 Bad Request - POST http://nexus.proxy/repository/npmtao/-/npm/v1/security/audits/quick
npm verb audit error     at /usr/local/lib/node_modules/npm/node_modules/npm-registry-fetch/lib/check-response.js:95:15
npm verb audit error     at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
npm verb audit error     at async [getReport] (/usr/local/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/audit-report.js:335:21)
npm verb audit error     at async AuditReport.run (/usr/local/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/audit-report.js:106:19)
npm verb audit error  HttpErrorGeneral: 400 Bad Request - POST http://nexus.proxy/repository/npmtao/-/npm/v1/security/audits/quick
npm verb audit error     at /usr/local/lib/node_modules/npm/node_modules/npm-registry-fetch/lib/check-response.js:95:15
npm verb audit error     at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
npm verb audit error     at async [getReport] (/usr/local/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/audit-report.js:335:21)
npm verb audit error     at async AuditReport.run (/usr/local/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/audit-report.js:106:19) {
npm verb audit error   headers: [Object: null prototype] {
npm verb audit error     date: [ 'Thu, 23 Feb 2023 08:38:03 GMT' ],
npm verb audit error     server: [ 'Nexus/3.29.2-02 (OSS)' ],
npm verb audit error     'x-content-type-options': [ 'nosniff' ],
npm verb audit error     'content-security-policy': [
npm verb audit error       'sandbox allow-forms allow-modals allow-popups allow-presentation allow-scripts allow-top-navigation'
npm verb audit error     ],
npm verb audit error     'x-xss-protection': [ '1; mode=block' ],
npm verb audit error     'content-type': [ 'application/json' ],
npm verb audit error     'content-length': [ '228' ],
npm verb audit error     'x-fetch-attempts': [ '1' ]
npm verb audit error   },
npm verb audit error   statusCode: 400,
npm verb audit error   code: 'E400',
npm verb audit error   method: 'POST',
npm verb audit error   uri: 'http://nexus.proxy/repository/npmtao/-/npm/v1/security/audits/quick',
npm verb audit error   body: <Buffer 0a 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ... 178 more bytes>,
npm verb audit error   pkgid: 'quick'
npm verb audit error }
npm timing auditReport:getReport Completed in 684ms
npm timing reify:audit Completed in 684ms
npm verb stack Error: write EPIPE
npm verb stack     at WriteWrap.onWriteComplete [as oncomplete] (node:internal/stream_base_commons:94:16)
npm verb cwd /workspace/source
npm verb Linux 4.19.90-2112.8.0.0131.oe1.aarch64
npm verb node v18.12.1
npm verb npm  v8.19.2
npm ERR! code EPIPE
npm ERR! syscall write
npm ERR! errno -32
npm ERR! write EPIPE
npm verb exit -32
npm timing npm Completed in 3234ms
npm verb unfinished npm timer command:install 1677141480684
npm verb unfinished npm timer reify 1677141480687
npm verb unfinished npm timer reify:unpack 1677141483111
...
npm verb code -32

npm ERR! A complete log of this run can be found in:
npm ERR!     /root/.npm/_logs/2023-02-23T08_38_00_546Z-debug-0.log

It seems that the problem caused by checking the audit failure.

however, sometimes it can be executed successfully, and at the same time, an error is reported in the audit check.

npm install --verbose
npm verb cli /usr/local/bin/node /usr/local/bin/npm
npm info using npm@8.19.2
npm info using node@v18.12.1
npm timing npm:load:whichnode Completed in 1ms
npm timing config:load:defaults Completed in 2ms
npm timing config:load:file:/usr/local/lib/node_modules/npm/npmrc Completed in 1ms
npm timing config:load:builtin Completed in 1ms
npm timing config:load:cli Completed in 2ms
npm timing config:load:env Completed in 0ms
npm timing config:load:file:/workspace/source/.npmrc Completed in 0ms
npm timing config:load:project Completed in 8ms
npm timing config:load:file:/root/.npmrc Completed in 1ms
npm timing config:load:user Completed in 1ms
npm timing config:load:file:/usr/local/etc/npmrc Completed in 0ms
npm timing config:load:global Completed in 0ms
npm timing config:load:validate Completed in 1ms
npm timing config:load:credentials Completed in 1ms
npm timing config:load:setEnvs Completed in 2ms
npm timing config:load Completed in 22ms
npm timing npm:load:configload Completed in 22ms
npm timing npm:load:mkdirpcache Completed in 1ms
npm timing npm:load:mkdirplogs Completed in 1ms
npm verb title npm install
npm verb argv "install" "--loglevel" "verbose"
npm timing npm:load:setTitle Completed in 1ms
npm timing config:load:flatten Completed in 4ms
npm timing npm:load:display Completed in 8ms
npm verb logfile logs-max:10 dir:/root/.npm/_logs
npm verb logfile /root/.npm/_logs/2023-02-23T09_35_23_010Z-debug-0.log
npm timing npm:load:logFile Completed in 6ms
npm timing npm:load:timers Completed in 1ms
npm timing npm:load:configScope Completed in 0ms
npm timing npm:load Completed in 41ms
npm timing arborist:ctor Completed in 1ms
npm timing idealTree:init Completed in 806ms
...
npm timing idealTree:buildDeps Completed in 573ms
npm timing idealTree:fixDepFlags Completed in 9ms
npm timing idealTree Completed in 1400ms
npm timing reify:loadTrees Completed in 1402ms
npm timing reify:diffTrees Completed in 22ms
npm timing reify:retireShallow Completed in 1ms
npm timing reify:createSparse Completed in 924ms
npm timing reify:loadBundles Completed in 0ms
npm verb reify failed optional dependency /workspace/source/node_modules/fsevents
npm timing reifyNode:node_modules/fsevents Completed in 158ms
npm http fetch POST 404 http://nexus.proxy:8081/repository/npmtao/-/npm/v1/security/advisories/bulk 315ms
npm http fetch POST 400 http://nexus.proxy:8081/repository/npmtao/-/npm/v1/security/audits/quick 100ms
npm verb audit error HttpErrorGeneral: 400 Bad Request - POST http://nexus.proxy:8081/repository/npmtao/-/npm/v1/security/audits/quick
npm verb audit error     at /usr/local/lib/node_modules/npm/node_modules/npm-registry-fetch/lib/check-response.js:95:15
npm verb audit error     at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
npm verb audit error     at async [getReport] (/usr/local/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/audit-report.js:335:21)
npm verb audit error     at async AuditReport.run (/usr/local/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/audit-report.js:106:19)
npm verb audit error  HttpErrorGeneral: 400 Bad Request - POST http://nexus.proxy:8081/repository/npmtao/-/npm/v1/security/audits/quick
npm verb audit error     at /usr/local/lib/node_modules/npm/node_modules/npm-registry-fetch/lib/check-response.js:95:15
npm verb audit error     at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
npm verb audit error     at async [getReport] (/usr/local/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/audit-report.js:335:21)
npm verb audit error     at async AuditReport.run (/usr/local/lib/node_modules/npm/node_modules/@npmcli/arborist/lib/audit-report.js:106:19) {
npm verb audit error   headers: [Object: null prototype] {
npm verb audit error     date: [ 'Thu, 23 Feb 2023 09:35:26 GMT' ],
npm verb audit error     server: [ 'Nexus/3.29.2-02 (OSS)' ],
npm verb audit error     'x-content-type-options': [ 'nosniff' ],
npm verb audit error     'content-security-policy': [
npm verb audit error       'sandbox allow-forms allow-modals allow-popups allow-presentation allow-scripts allow-top-navigation'
npm verb audit error     ],
npm verb audit error     'x-xss-protection': [ '1; mode=block' ],
npm verb audit error     'content-type': [ 'application/json' ],
npm verb audit error     'content-length': [ '228' ],
npm verb audit error     'x-fetch-attempts': [ '1' ]
npm verb audit error   },
npm verb audit error   statusCode: 400,
npm verb audit error   code: 'E400',
npm verb audit error   method: 'POST',
npm verb audit error   uri: 'http://nexus.proxy:8081/repository/npmtao/-/npm/v1/security/audits/quick',
npm verb audit error   body: <Buffer 0a 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d 3d ... 178 more bytes>,
npm verb audit error   pkgid: 'quick'
npm verb audit error }
npm timing auditReport:getReport Completed in 739ms
npm timing reify:audit Completed in 739ms
npm http fetch GET 200 http://nexus.proxy:8081/repository/npmtao/fromentries/-/fromentries-1.3.2.tgz 2831ms (cache miss)
npm timing reifyNode:node_modules/fromentries Completed in 3695ms
npm http fetch GET 200 http://nexus.proxy:8081/repository/npmtao/es6-error/-/es6-error-4.1.1.tgz 2829ms (cache miss)
npm timing reifyNode:node_modules/es6-error Completed in 3696ms
npm http fetch GET 200 http://nexus.proxy:8081/repository/npmtao/clean-stack/-/clean-stack-2.2.0.tgz 2827ms (cache miss)
npm timing reifyNode:node_modules/clean-stack Completed in 3696ms
...
npm timing build:link Completed in 74ms
npm timing build:deps Completed in 104ms
npm timing build Completed in 105ms
npm timing reify:build Completed in 107ms
npm timing reify:trash Completed in 2ms
npm timing reify:save Completed in 687ms
npm timing reify Completed in 23944ms

added 921 packages in 24s

4 packages are looking for funding
  run `npm fund` for details
npm timing command:install Completed in 23975ms
npm notice 
npm notice New major version of npm available! 8.19.2 -> 9.5.1
npm notice Changelog: <https://github.com/npm/cli/releases/tag/v9.5.1>
npm notice Run `npm install -g npm@9.5.1` to update!
npm notice 
npm verb exit 0
npm timing npm Completed in 24107ms
npm info ok 

when I turned off the audit check, it was stable and successful.

When I turned off the audit check, it was stable and successful.

Expected Behavior

I think audit check should be stable for npm install . It shouldn't be a case of occasional success and occasional failure now.

Steps To Reproduce

  1. create a build image through dockerfile
FROM node:18-buster-slim

RUN apt-get update && apt-get install -y --no-install-recommends \
    build-essential libssl-dev && \
    chmod -R 777  /usr/local/lib/node_modules/ && \
    rm -rf /var/lib/apt/lists/*

RUN yarn global add @angular/cli@12.2.0 --unsafe-perm
  1. run the build in K8S,execute the script in the pod
npm config set registry=http://nexus.proxy/repository/npmtao
npm install --verbose

Environment

  • npm: 8.19.2
  • Node.js: v18.12.1
  • OS Name: Linux test-local-qhrzl-pod 4.19.90-2112.8.0.0131.oe1.aarch64 # 1 SMP Fri Dec 31 19:53:20 UTC 2021 aarch64 GNU/Linux
  • System Model Name: centos7
  • npm config:
; "user" config from /root/.npmrc

registry = "http://nexus.proxy/repository/npmtao/" 

; node bin location = /usr/local/bin/node
; node version = v18.12.1
; npm local prefix = /workspace/source
; npm version = 8.19.2
; cwd = /workspace/source
; HOME = /root
; Run `npm config ls -l` to show all defaults.
@kycheng kycheng added Bug thing that needs fixing Needs Triage needs review for next steps Release 8.x work is associated with a specific npm 8 release labels Feb 23, 2023
@wraithgar
Copy link
Member

Yes you are going to need to disable audits if your registry does not support them. Specifically if your registry returns a 400 instead of a 404. 404 tells npm that audit endpoint doesn't exist. 400 tells npm that the request had some sort of error that npm could theoretically recover from if it sent a more correct request. This doesn't appear to be the case, it appears that the registry you are using is incompatible w/ the audit request npm sends.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug thing that needs fixing Needs Triage needs review for next steps Release 8.x work is associated with a specific npm 8 release
Projects
None yet
Development

No branches or pull requests

2 participants