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

Error installing dependencies in Node 20.x #741

Closed
javierlopezdeancos opened this issue Apr 1, 2024 · 3 comments · Fixed by #742
Closed

Error installing dependencies in Node 20.x #741

javierlopezdeancos opened this issue Apr 1, 2024 · 3 comments · Fixed by #742
Assignees
Labels
bug Something isn't working

Comments

@javierlopezdeancos
Copy link
Contributor

Expected Behaviour
Complete a npm install with success to Node LTS 20.x version

Actual Behaviour

testcontainers-node git:(main) node --version
v20.12.0
\u279c  testcontainers-node git:(main) npm i
npm WARN deprecated [email protected]: This functionality has been moved to @npmcli/fs
npm WARN deprecated [email protected]: Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.
npm WARN deprecated @types/[email protected]: This is a stub types definition. redis provides its own type definitions, so you do not need this installed.
npm WARN deprecated @npmcli/[email protected]: This functionality has been moved to @npmcli/fs
npm WARN deprecated [email protected]: This proposal has been altered; please use https://npmjs.com/object.groupby instead!
npm ERR! code 1
npm ERR! path /home/javierlopezdeancos/Code/testcontainers/testcontainers-node/node_modules/couchbase
npm ERR! command failed
npm ERR! command sh -c prebuild-install || node-gyp rebuild
npm ERR! prebuild-install warn install No prebuilt binaries found (target=20.12.0 runtime=node arch=arm64 libc= platform=linux)
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using [email protected]
npm ERR! gyp info using [email protected] | linux | arm64
npm ERR! gyp info find Python using Python version 3.10.12 found at "/usr/bin/python3"
npm ERR! gyp info spawn /usr/bin/python3
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args   '/home/javierlopezdeancos/Code/testcontainers/testcontainers-node/node_modules/node-gyp/gyp/gyp_main.py',
npm ERR! gyp info spawn args   'binding.gyp',
npm ERR! gyp info spawn args   '-f',
npm ERR! gyp info spawn args   'make',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   '/home/javierlopezdeancos/Code/testcontainers/testcontainers-node/node_modules/couchbase/build/config.gypi',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   '/home/javierlopezdeancos/Code/testcontainers/testcontainers-node/node_modules/node-gyp/addon.gypi',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   '/home/javierlopezdeancos/.cache/node-gyp/20.12.0/include/node/common.gypi',
npm ERR! gyp info spawn args   '-Dlibrary=shared_library',
npm ERR! gyp info spawn args   '-Dvisibility=default',
npm ERR! gyp info spawn args   '-Dnode_root_dir=/home/javierlopezdeancos/.cache/node-gyp/20.12.0',
npm ERR! gyp info spawn args   '-Dnode_gyp_dir=/home/javierlopezdeancos/Code/testcontainers/testcontainers-node/node_modules/node-gyp',
npm ERR! gyp info spawn args   '-Dnode_lib_file=/home/javierlopezdeancos/.cache/node-gyp/20.12.0/<(target_arch)/node.lib',
npm ERR! gyp info spawn args   '-Dmodule_root_dir=/home/javierlopezdeancos/Code/testcontainers/testcontainers-node/node_modules/couchbase',
npm ERR! gyp info spawn args   '-Dnode_engine=v8',
npm ERR! gyp info spawn args   '--depth=.',
npm ERR! gyp info spawn args   '--no-parallel',
npm ERR! gyp info spawn args   '--generator-output',
npm ERR! gyp info spawn args   'build',
npm ERR! gyp info spawn args   '-Goutput_dir=.'
npm ERR! gyp info spawn args ]
npm ERR! gyp ERR! build error 
npm ERR! gyp ERR! stack Error: not found: make
npm ERR! gyp ERR! stack     at getNotFoundError (/home/javierlopezdeancos/Code/testcontainers/testcontainers-node/node_modules/which/which.js:10:17)
npm ERR! gyp ERR! stack     at /home/javierlopezdeancos/Code/testcontainers/testcontainers-node/node_modules/which/which.js:57:18
npm ERR! gyp ERR! stack     at new Promise (<anonymous>)
npm ERR! gyp ERR! stack     at step (/home/javierlopezdeancos/Code/testcontainers/testcontainers-node/node_modules/which/which.js:54:21)
npm ERR! gyp ERR! stack     at /home/javierlopezdeancos/Code/testcontainers/testcontainers-node/node_modules/which/which.js:71:22
npm ERR! gyp ERR! stack     at new Promise (<anonymous>)
npm ERR! gyp ERR! stack     at subStep (/home/javierlopezdeancos/Code/testcontainers/testcontainers-node/node_modules/which/which.js:69:33)
npm ERR! gyp ERR! stack     at /home/javierlopezdeancos/Code/testcontainers/testcontainers-node/node_modules/which/which.js:80:22
npm ERR! gyp ERR! stack     at /home/javierlopezdeancos/Code/testcontainers/testcontainers-node/node_modules/isexe/index.js:42:5
npm ERR! gyp ERR! stack     at /home/javierlopezdeancos/Code/testcontainers/testcontainers-node/node_modules/isexe/mode.js:8:5
npm ERR! gyp ERR! System Linux 5.15.0-101-generic
npm ERR! gyp ERR! command "/home/javierlopezdeancos/.nvm/versions/node/v20.12.0/bin/node" "/home/javierlopezdeancos/Code/testcontainers/testcontainers-node/node_modules/.bin/node-gyp" "rebuild"
npm ERR! gyp ERR! cwd /home/javierlopezdeancos/Code/testcontainers/testcontainers-node/node_modules/couchbase
npm ERR! gyp ERR! node -v v20.12.0
npm ERR! gyp ERR! node-gyp -v v9.4.1
npm ERR! gyp ERR! not ok

npm ERR! A complete log of this run can be found in: /home/javierlopezdeancos/.npm/_logs/2024-04-01T08_33_53_220Z-debug-0.log

Testcontainer Logs
No apply

Steps to Reproduce

  1. Go to the project page
  2. Copy the url to clone it fresh
  3. Clone the repo into your local machine
  4. Select the last LTS Node 20.x version 20.12.0
  5. Execute npm install

Environment Information

  • Operating System: Ubuntu LTS 22.x but Is reproducible in MacOS too
  • Docker Version:
  • Node version: 20.12.0 LTS but is reproducible in any old LTS 20.x
  • Testcontainers version: latest
@javierlopezdeancos
Copy link
Contributor Author

@cristianrgreco Looking deep into the problem, I resolve the issue locally updating couchbase dependency into the file
packages/modules/couchbase/pacjage.json

 "devDependencies": {
    "@types/couchbase": "^2.4.9",
-    "couchbase": "3.2.7"
+    "couchbase": "4.3.0"
  }

This change resolve the installation issue but, I don't know if with the recent problems we have had with the Couchbase module, having to exclude it from the pipeline #738, we should now upgrade its dependency to a larger one, which would perhaps cause us to encounter some other problems.

@cristianrgreco
Copy link
Collaborator

@javierlopezdeancos sounds good to me. Maybe the newer version doesn't cause a pipeline issue

@javierlopezdeancos
Copy link
Contributor Author

javierlopezdeancos commented Apr 1, 2024

@christopherjwang yes it is, I was checking it and is causing the issue too.

My deep investigation is that, I don't know why, the node-fetch library that we are using, when we change to Node 20.x experiment problems in one couchbase call
https://github.com/testcontainers/testcontainers-node/blob/main/packages/modules/couchbase/src/couchbase-container.ts#L301

FAIL packages/modules/couchbase/src/couchbase-container.test.ts (78.392 s)
CouchbaseContainer
Enterprise Image
✕ should connect and query using enterprise image (27383 ms)
✕ should flush bucket if flushEnabled and check any document exists (7864 ms)
Community Image
✕ should connect and query using community image (19874 ms)
✕ should flush bucket if flushEnabled and check any document exists (6583 ms)
✓ should throw error if analytics service enabled with community version (6474 ms)
✓ should throw error if eventing service enabled with community version (6435 ms)
● CouchbaseContainer › Enterprise Image › should connect and query using enterprise image
Could not perform request against couchbase HTTP endpoint FetchError: request to http://localhost:32778/node/controller/setupAlternateAddresses/external failed, reason: socket hang up
96 | });
97 | } catch (e) {
> 98 | throw new Error(`Could not perform request against couchbase HTTP endpoint ${e}`);
| ^
99 | }
100 | }
101 |
at CouchbaseContainer.doHttpRequest (src/couchbase-container.ts:98:13)
at async CouchbaseContainer.configureExternalPorts (src/couchbase-container.ts:336:22)
at async CouchbaseContainer.containerStarted (src/couchbase-container.ts:543:5)
at async CouchbaseContainer.startContainer (../../testcontainers/src/generic-container/generic-container.ts:213:7)
at async CouchbaseContainer.start (src/couchbase-container.ts:567:42)
at async Object.<anonymous> (src/couchbase-container.test.ts:55:30)

An interesting point here is, if you set a breakpoint before this call and doing the call via curl, the results is ....ok

curl -v -X PUT -u Administrator:password http://127.0.0.1:32944/node/controller/setupAltern
ateAddresses/external -d hostname=127.0.0.1 -d mgmt=32944         	 
*   Trying 127.0.0.1:32944...
* Connected to 127.0.0.1 (127.0.0.1) port 32944
* Server auth using Basic with user 'Administrator'
> PUT /node/controller/setupAlternateAddresses/external HTTP/1.1
> Host: 127.0.0.1:32944
> Authorization: Basic QWRtaW5pc3RyYXRvcjpwYXNzd29yZA==
> User-Agent: curl/8.4.0
> Accept: */*
> Content-Length: 29
> Content-Type: application/x-www-form-urlencoded
>
< HTTP/1.1 200 OK
< Cache-Control: no-cache,no-store,must-revalidate
< Content-Length: 0
< Date: Tue, 26 Mar 2024 15:20:20 GMT
< Expires: Thu, 01 Jan 1970 00:00:00 GMT
< Pragma: no-cache
< Server: Couchbase Server
< X-Content-Type-Options: nosniff
< X-Frame-Options: DENY
< X-Permitted-Cross-Domain-Policies: none
< X-XSS-Protection: 1; mode=block
<
* Connection #0 to host 127.0.0.1 left intact

So, a couple of questions to investigate here

  1. Why this call is failing and not the previous ones that use the same node-fetch wrapper
  2. Why this call fails via http and not via curl

But let me create a pr to update the Couchbase dependency to resolve this issue

@javierlopezdeancos javierlopezdeancos self-assigned this Apr 1, 2024
@cristianrgreco cristianrgreco added bug Something isn't working patch Backward compatible bug fix and removed patch Backward compatible bug fix labels Apr 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants