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

Cabal (terminal) fails to start: ERR_INVALID_ARG_TYPE (v12 node) #220

Closed
decentral1se opened this issue May 21, 2023 · 6 comments
Closed

Comments

@decentral1se
Copy link

On latest Debian.

💻 nvm install 12
v12.22.12 is already installed.
Now using node v12.22.12 (npm v6.14.16)
💻 npm install --global cabal
npm WARN deprecated dat-dns@4.1.3: Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.
/home/d/.nvm/versions/node/v12.22.12/bin/cabal -> /home/d/.nvm/versions/node/v12.22.12/lib/node_modules/cabal/cli.js
npm WARN notsup Unsupported engine for nopt@7.1.0: wanted: {"node":"^14.17.0 || ^16.13.0 || >=18.0.0"} (current: {"node":"12.22.12","npm":"6.14.16"})
npm WARN notsup Not compatible with your version of node/npm: nopt@7.1.0
npm WARN notsup Unsupported engine for abbrev@2.0.0: wanted: {"node":"^14.17.0 || ^16.13.0 || >=18.0.0"} (current: {"node":"12.22.12","npm":"6.14.16"})
npm WARN notsup Not compatible with your version of node/npm: abbrev@2.0.0
+ cabal@14.1.2
updated 21 packages in 12.608s
💻 cabal cabal://324eee92611cd877841c4de9fd5253e9dba6033329a837ee5f01beb005dffb2f
buffer.js:358
    throw new ERR_INVALID_ARG_TYPE('size', 'number', size);
    ^
TypeError [ERR_INVALID_ARG_TYPE]: The "size" argument must be of type number. Received undefined
    at Function.alloc (buffer.js:370:3)
    at Function.keyPair (/home/d/.nvm/versions/node/v12.22.12/lib/node_modules/cabal/node_modules/simple-hypercore-protocol/lib/handshake.js:67:25)
    at Function.keyPair (/home/d/.nvm/versions/node/v12.22.12/lib/node_modules/cabal/node_modules/simple-hypercore-protocol/index.js:234:22)
    at Function.keyPair (/home/d/.nvm/versions/node/v12.22.12/lib/node_modules/cabal/node_modules/hypercore-protocol/index.js:398:16)
    at new Feed (/home/d/.nvm/versions/node/v12.22.12/lib/node_modules/cabal/node_modules/hypercore/index.js:74:53)
    at Feed (/home/d/.nvm/versions/node/v12.22.12/lib/node_modules/cabal/node_modules/hypercore/index.js:54:39)
    at /home/d/.nvm/versions/node/v12.22.12/lib/node_modules/cabal/node_modules/multifeed/index.js:62:16
    at /home/d/.nvm/versions/node/v12.22.12/lib/node_modules/cabal/node_modules/multifeed/ready.js:7:7
    at processTicksAndRejections (internal/process/task_queues.js:79:11) {
  code: 'ERR_INVALID_ARG_TYPE'
}

@sorenpeter
Copy link

Also getting the same error on MacOS BigSur

@decentral1se decentral1se changed the title Cabal fails to start: ERR_INVALID_ARG_TYPE (v12 node) Cabal (terminal) fails to start: ERR_INVALID_ARG_TYPE (v12 node) May 29, 2023
@cblgh
Copy link
Member

cblgh commented May 30, 2023

@sorenpeter @decentral1se thanks for the issue! looks like one of our deps did something unexpected in a patch they released a while back. ironically it hasn't been caught by devs because that dep is pinned by package-lock.json which npm ignores when installing via npm install lol.

can y'all try this prepatch release i made to see if it fixes the issue for y'all?

npm -i g cabal@14.1.4-0

i could replicate the issue and the solution in 14.1.4-0 fixed it for me, keen to hear if that's broadly the case for others :)

@ralphtheninja
Copy link
Member

@cblgh You mean a package-lock.json in a dependency to cabal-cli?

@cblgh
Copy link
Member

cblgh commented May 30, 2023

@ralphtheninja i mean a published version of cabal-cli will not have package-lock.json be used to determine which dependncies are downloaded whe running the command npm install --global afaiu

in our case, the culprit causing issues appears to have been emilbayes/noise-protocol@2891a1f i.e. noise-protocol@3.0.1 has cabal working as intended (which appears to be the case when cloning cabal-cli and installing with npm i inside the repo folder) while having noise-protocol@3.0.2 installed (as seems to be the case when running npm i -g cabal) causes the issue mentioned in the original post

@ralphtheninja
Copy link
Member

n our case, the culprit causing issues appears to have been emilbayes/noise-protocol@2891a1f i.e. noise-protocol@3.0.1 has cabal working as intended (which appears to be the case when cloning cabal-cli and installing with npm i inside the repo folder) while having noise-protocol@3.0.2 installed (as seems to be the case when running npm i -g cabal) causes the issue mentioned in the original post

Ah makes sense. Maybe we should remove package-lock.json completely? This way a dev or someone using the cli application directly from source will notice problems earlier. Also a bit unfortunate that a new patch version of noise-protocol broke this.

@decentral1se
Copy link
Author

decentral1se commented May 30, 2023

Thank you @cblgh, npm install -g cabal@14.1.4-0 worked! I'm in.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants