wbyoung/avn

`avn setup` throws error `TypeError: cb.apply is not a function`

wangyizhuo opened this issue ยท 6 comments

Please describe your issue clearly and also include all details below.

Details

  • avn avn --version 0.2.4
  • node node --version v12.19.0
  • nvm nvm --version 0.35.3
  • n n --version n/a
  • zsh zsh --version zsh 5.8 (x86_64-apple-darwin19.3.0)
  • bash bash --version n/a

Steps to reproduce

avn setup

Output

avn: profile already set up (~/.zshrc)
/Users/wyz/.nvm/versions/node/v12.19.0/lib/node_modules/avn/node_modules/npm/node_modules/graceful-fs/polyfills.js:267
      if (cb) cb.apply(this, arguments)
                 ^

TypeError: cb.apply is not a function
    at /Users/wyz/.nvm/versions/node/v12.19.0/lib/node_modules/avn/node_modules/npm/node_modules/graceful-fs/polyfills.js:267:18

nvm specific

  • [ Y] As an nvm user I am confirming that I did not install with Homebrew

See the discussion starting here: #105 (comment)

PR welcome.

I can confirm this critical bug on Ubuntu 20.04.1 LTS with avn 0.2.4 and nvm 0.37.0 (latest).

nvm use default --latest-npm
Now using node v14.15.0 (npm v6.14.8)
avn setup
avn: profile already set up (~/.bash_profile)
avn: profile already set up (~/.zshrc)
/home/redtux/.nvm/versions/node/v14.15.0/lib/node_modules/avn/node_modules/npm/node_modules/graceful-fs/polyfills.js:267
      if (cb) cb.apply(this, arguments)
                 ^

TypeError: cb.apply is not a function
    at /home/redtux/.nvm/versions/node/v14.15.0/lib/node_modules/avn/node_modules/npm/node_modules/graceful-fs/polyfills.js:267:18
    at FSReqCallback.oncomplete (fs.js:184:5)

With node v10.23.0 it works.

nvm use lts/dubnium --latest-npm
Now using node v10.23.0 (npm v6.14.8)
avn setup
avn: profile already set up (~/.zshrc)
avn: profile already set up (~/.bash_profile)
avn: configuration complete (~/.avnrc)kipping project config: /home/redtux/.npmrc. (matches userconfig)
avn-nvm: installation complete
avn-n: installation complete

PS: Not volunteering for a PR or patch, just for information. โค๏ธ

Any updates on this? I'm still getting this exact error now, running:

  • node.js v14.16.1
  • avn v2.4
  • macOS v10.13.5

@andfaulkner I may have mentioned on other issues that I haven't really worked on this for quite some time. It'd actually be good to find someone interested in maintaining it. But at this point, no progress on this particular issue, but any PR would be welcome.

I'm using n and I fixed it with:

  1. cd ~/.avn
  2. n auto (this installed node v4.0)
  3. cd && rm -R ~/.avn
  4. npm install -g avn avn-nvm avn-n
  5. avn setup
  6. And now it should work
leemm commented

To get it working with nvm this is what I did.

avn requires nodejs v4 to run sensibly, this is key.

  1. cd ~/
  2. nvm install 4
  3. npm install -g avn avn-nvm avn-n
  4. avn setup
  5. nvm use default
  6. cd <your project directory>