hyperledger / identus-edge-agent-sdk-ts

Apache License 2.0
24 stars 13 forks source link

npm i failure #301

Closed chereseeriepa closed 1 month ago

chereseeriepa commented 1 month ago

Is this a regression?

Yes

Description

Running npm i is failing

Please provide the exception or error you saw

~/identus-edge-agent-sdk-ts main !1 > npm i
node 20.18.0
npm warn cleanup Failed to remove some directories [
npm warn cleanup   [
npm warn cleanup     '/identus-edge-agent-sdk-ts/node_modules/@swc',
npm warn cleanup     [Error: ENOTEMPTY: directory not empty, rmdir '/identus-edge-agent-sdk-ts/node_modules/@swc'] {
npm warn cleanup       errno: -66,
npm warn cleanup       code: 'ENOTEMPTY',
npm warn cleanup       syscall: 'rmdir',
npm warn cleanup       path: '/identus-edge-agent-sdk-ts/node_modules/@swc'
npm warn cleanup     }
npm warn cleanup   ]
npm warn cleanup ]
npm error code 1
npm error path /identus-edge-agent-sdk-ts/node_modules/esbuild
npm error command failed
npm error command sh -c node install.js
npm error [esbuild] Failed to find package "@esbuild/darwin-x64" on the file system
npm error
npm error This can happen if you use the "--no-optional" flag. The "optionalDependencies"
npm error package.json feature is used by esbuild to install the correct binary executable
npm error for your current platform. This install script will now attempt to work around
npm error this. If that fails, you need to remove the "--no-optional" flag to use esbuild.
npm error
npm error [esbuild] Trying to install package "@esbuild/darwin-x64" using npm
npm error node:internal/errors:984
npm error   const err = new Error(message);
npm error               ^
npm error
npm error Error: Command failed: /identus-edge-agent-sdk-ts/node_modules/esbuild/bin/esbuild --version
npm error     at genericNodeError (node:internal/errors:984:15)
npm error     at wrappedFn (node:internal/errors:538:14)
npm error     at checkExecSyncError (node:child_process:891:11)
npm error     at Object.execFileSync (node:child_process:927:15)
npm error     at validateBinaryVersion (/identus-edge-agent-sdk-ts/node_modules/esbuild/install.js:99:28)
npm error     at /identus-edge-agent-sdk-ts/node_modules/esbuild/install.js:283:5
npm error     at process.processTicksAndRejections (node:internal/process/task_queues:95:5) {
npm error   status: null,
npm error   signal: 'SIGKILL',
npm error   output: [ null, Buffer(0) [Uint8Array] [], Buffer(0) [Uint8Array] [] ],
npm error   pid: 84069,
npm error   stdout: Buffer(0) [Uint8Array] [],
npm error   stderr: Buffer(0) [Uint8Array] []
npm error }
npm error
npm error Node.js v20.18.0
npm error A complete log of this run can be found in: /.npm/_logs/2024-10-11T03_05_04_845Z-debug-0.log

Please provide the environment you discovered this bug in

Node.js v20.18.0
npm v10.8.2
macOS Senoma Version 14.6.1 (23G93)

Anything else?

I freshly cloned the repo and came across this error.

elribonazo commented 1 month ago

I need to reproduce this on a mac with intel cpu right?

elribonazo commented 1 month ago

On my side, also on darwin x64,

installing : node-v20.18.0 mkdir : /usr/local/n/versions/node/20.18.0 fetch : https://nodejs.org/dist/v20.18.0/node-v20.18.0-darwin-x64.tar.xz installed : v20.18.0 (with npm 10.8.2) MacBook-Pro-de-Fco-2:identus-edge-agent-sdk-ts ribo$ MacBook-Pro-de-Fco-2:identus-edge-agent-sdk-ts ribo$ npm i

@hyperledger/identus-edge-agent-sdk@3.1.0 preinstall sh preinstall.sh

running preinstall in /Users/ribo/projects/personal/identus-edge-agent-sdk-ts

removed 5 packages, changed 96 packages, and audited 1978 packages in 21s

318 packages are looking for funding run npm fund for details

11 vulnerabilities (5 moderate, 1 high, 5 critical)

To address issues that do not require attention, run: npm audit fix

To address all issues (including breaking changes), run: npm audit fix --force

Run npm audit for details. patch-package 8.0.0 Applying patches... rxdb@14.17.1 ✔

@hyperledger/identus-edge-agent-sdk@3.1.0 postinstall sh postinstall.sh

running postinstall in /Users/ribo/projects/personal/identus-edge-agent-sdk-ts

removed 92 packages, changed 3 packages, and audited 1886 packages in 4s

318 packages are looking for funding run npm fund for details

2 vulnerabilities (1 moderate, 1 high)

To address all issues, run: npm audit fix

Run npm audit for details.

@hyperledger/identus-edge-agent-sdk@3.1.0 prepare npx husky

changed 1696 packages, and audited 1886 packages in 2m

318 packages are looking for funding run npm fund for details

2 vulnerabilities (1 moderate, 1 high)

To address all issues, run: npm audit fix

Run npm audit for details.

elribonazo commented 1 month ago

The error states that the folder is not empty, could it be possible that the node_modules as not completely empty?

I basically got no issues, even build

chereseeriepa commented 1 month ago

I think the error is with the package-lock.json, because I came across this when cloning the repo, meaning there are no node_modules to begin with.

if I delete the package-lock.json I’m able to install, but there were a lot of warnings.

2.3GHz 8‑core Intel Core i9

elribonazo commented 1 month ago

Strange, I couldn't reproduce earlier in a clean environment with same CPU. BUT, i've reproduced building from a docker image, exactly your issue.

Origin of the issue: This is related to Pluto and the fact that RXDB has a vulnerable dependency which we are manually patching and this is leading to some unexpected issues on package lock

Now that I can reproduce easily i'll quickly come up with something, thanks!

elribonazo commented 1 month ago

I've created a branch for u to test fix/build-from-docker

In order to run it:

docker build -t atalaprismwalletsdkts:latest "." 
docker run  -v $(pwd)/build:/app/build atalaprismwalletsdkts:latest

That should create the build for you in the current directory in ./build if u still have any trouble I can merge that to main if not we can close the issue :)

chereseeriepa commented 1 month ago

It worked, but it was very slow and took a while. It was unclear what the commands were actually doing. The docker build command ran quickly. After I ran the docker run command, it took about 5 minutes for something to actually show up in the console and took about 22 minutes to complete.