Skip to content
This repository has been archived by the owner on Dec 6, 2023. It is now read-only.

Cannot find module #105

Closed
verpixelt opened this issue Jul 17, 2020 · 15 comments
Closed

Cannot find module #105

verpixelt opened this issue Jul 17, 2020 · 15 comments

Comments

@verpixelt
Copy link

verpixelt commented Jul 17, 2020

On node 14.5.0 when trying to switch to a folder with a .node-version folder the app throws the following error: Fatal Error: Cannot find module '/Users/verpixelt/.avn/plugins/avn-nvm'
Details

  • avn avn 0.2.4
  • node node 14.5.0
  • n n 6.5.1
  • zsh zsh 5.7.1

The output of __avn_debug in the directory with a .node-version file is:

Fatal Error: Cannot find module '/Users/verpixelt/.avn/plugins/avn-nvm'.
Require stack:
- /Users/verpixelt/.avn/lib/plugins.js
- /Users/verpixelt/.avn/lib/hooks.js
- /Users/verpixelt/.avn/lib/avn.js
- /Users/verpixelt/.avn/index.js
- /Users/verpixelt/.avn/bin/_avn

avn is loaded in my ~/.{bash|zsh}{_profile|rc} file with:

`[[ -s "$HOME/.avn/bin/avn.sh" ]] && source "$HOME/.avn/bin/avn.sh" # load avn`
@wbyoung
Copy link
Owner

wbyoung commented Jul 17, 2020

Does /Users/verpixelt/.avn/plugins/avn-nvm look like a module?

@verpixelt
Copy link
Author

verpixelt commented Jul 19, 2020

There are no plugins inside the folder.

@wbyoung
Copy link
Owner

wbyoung commented Jul 19, 2020

Looks like you should try reinstalling.

rm -R ~/.avn

Then install.

@verpixelt
Copy link
Author

This is what happens during setup:

avn setup
avn: profile setup complete (~/.zshrc)
avn: restart your terminal to start using avn
/usr/local/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 /usr/local/lib/node_modules/avn/node_modules/npm/node_modules/graceful-fs/polyfills.js:267:18
    at FSReqCallback.oncomplete (fs.js:177:5)

@wbyoung
Copy link
Owner

wbyoung commented Jul 20, 2020

That seems quite strange. Did that happen before when you ran the setup as well?

This is the type of thing I'd expect all users to experience if it wasn't something unique to your environment.

Any chance you can work on tracking down where the issue is coming from within avn?

Without more detail, I'm going to be honest, I doubt I'd be able to come up with a solution.

@verpixelt
Copy link
Author

Thanks for your reply, @wbyoung. I've tried a few more things including switching from the latest node version at the time 14.5.0, to something lower. In my case I ran your avn setup with 10.0.0 and it worked 🎉
So I thought the node version might have been corrupted, removed it, re-installed 14.5.0 and it failed again, with the same error as posted above.

cb.apply is part of the polyfill.js in graceful-fs. Not sure tho why this would throw an error in my specific case. I've tried a fresh install on another machine. macOS 10.15.5, fresh n install, fresh node 14.5.0, same error on running avn setup.

@wbyoung
Copy link
Owner

wbyoung commented Jul 20, 2020

Ok, could be part of a dependency issue and comparability. Perhaps upgrading all of the dependencies of the project would fix it.

I don't do much coding these days. If you want to give that a try, go for it & let me know or submit a PR.

@lobanovkirill
Copy link

lobanovkirill commented Jul 25, 2020

Avn correct installed with node version 10.0.0
When i first installed Avn i used node version 14.6.0 and getting error, this error i gen and with node version 12.18.3
`/Users/usename/.nvm/versions/node/v12.18.3/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/usename/.nvm/versions/node/v12.18.3/lib/node_modules/avn/node_modules/npm/node_modules/graceful-fs/polyfills.js:267:18
at FSReqCallback.oncomplete (fs.js:169:5)`

@tybro0103
Copy link

+1

Setting up a new mac today. First tried to install with Node@12 and got the exact same thing as @lobanovkirill. Switched to Node@10 and it worked.

@wbyoung
Copy link
Owner

wbyoung commented Aug 5, 2020

Thanks for confirming, @tybro0103.

PR welcome.

@wbyoung
Copy link
Owner

wbyoung commented Oct 18, 2020

Closing this in favor of #106 which better represents the issue that @verpixelt had after reinstall.

@wbyoung wbyoung closed this as completed Oct 18, 2020
@konstantintieber
Copy link

konstantintieber commented Dec 10, 2020

I ran into the same issue when updating from node 10.13.0 to 14.15.1 using nvm

~ $ cd dev/web-pathfinder
Fatal Error: Cannot find module '/Users/konstantintieber/.avn/plugins/avn-n'
Require stack:
- /Users/konstantintieber/.avn/lib/plugins.js
- /Users/konstantintieber/.avn/lib/hooks.js
- /Users/konstantintieber/.avn/lib/avn.js
- /Users/konstantintieber/.avn/index.js
- /Users/konstantintieber/.avn/bin/_avn

Fixed it as suggested by @wbyoung with:

rm -R ~/.avn
nvm exec 10.13.0 npm install -g avn avn-nvm avn-n
nvm exec 10.13.0 avn setup

EDIT: if you do not have the node 10 version installed yet, you have to run nvm install 10.13.0 before executing the commands above

@ahmednawazkhan
Copy link

Thanks @konstantintieber. It worked

@cko-jimmy-wong
Copy link

cko-jimmy-wong commented Dec 13, 2021

This seems to have stopped working for node 16, I keep getting the same TypeError again

@wbyoung
Copy link
Owner

wbyoung commented Dec 13, 2021

@cko-jimmy-wong see/comment on #106, but please note the last comment in there about the lack of attention this project gets.

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

No branches or pull requests

7 participants