cabal-club / cabal-cli

Terminal client for Cabal, the p2p chat platform.

Home Page:https://cabal.chat

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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

decentral1se opened this issue Β· comments

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'
}

Also getting the same error on MacOS BigSur

@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 :)

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

@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

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.

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