derekstavis / plugin-nvm

Node version manager wrapper for Fish shell
MIT License
233 stars 12 forks source link

No default links created #8

Closed benmarten closed 4 years ago

benmarten commented 8 years ago

For some reason the plugin stopped working yesterday. I am using fish & omf. Tried reinstalling, but same issue.

After installation node/npm is not recognized as command. I can manually fix it by creating symlinks: ln -s /Users/Ben/.nvm/versions/node/v5.7.1/bin/npm /usr/local/bin/npm

but after that I run into permission issues... any idea whats changed or wrong?

derekstavis commented 8 years ago

Thanks for reporting! By the paths I can see you are running on OS X. Have you installed nvm via official installer or through brew? Also, what's you nvm --version? If possible, also give a dump of your nvm ls output.

benmarten commented 8 years ago

Yes, OS X. I thin I installed fish via home brew and then installed oh my fish, which comes with nvm wrapper i think... maybe i installed nvm via brew also, i can't remember right now...

anyways if i try to install nvm via brew again it says: Warning: nvm-0.31.0 already installed same for the nvm --version output...

derekstavis commented 8 years ago

I believe that you need to alias a default node version. In installs that's doesn't have a system node installed you need to do this: https://github.com/derekstavis/plugin-nvm/blob/master/.nvm-install-homebrew.sh#L27

benmarten commented 8 years ago

i rerun this script, does not work still... Actually node works in bash, but not in fish:

fish: Unknown command 'node'

Any other idea?

derekstavis commented 8 years ago

Probably nvm version I'm on 0.30.1. I will give a look and return as soon as I find something.

benmarten commented 8 years ago

Maybe the problem is that this path is not being sourced? /Users/Ben/.nvm/versions/node/v5.7.1/bin/ It seems to contain all the binaries needed to execute the commands ?

derekstavis commented 8 years ago

I updated nvm here and my install still works. This is my current PATH using the same node version:

⋊> ~/.l/s/o/p/nvm on master ● echo $PATH
/Users/derek/.nvm/versions/node/v5.7.1/bin /Users/derek/.rvm/gems/ruby-2.2.1/bin /Users/derek/.rvm/gems/ruby-2.2.1@global/bin /Users/derek/.rvm/rubies/ruby-2.2.1/bin /usr/local/bin /usr/bin /bin /usr/sbin /sbin /opt/X11/bin /Library/TeX/texbin /Users/derek/.rvm/bin

Also, you can see that node binary points to the right place:

⋊> ~/.l/s/o/p/nvm on master ● which node
/Users/derek/.nvm/versions/node/v5.7.1/bin/node
benmarten commented 8 years ago

ok, mine seems missing: /usr/local/bin /usr/bin /bin /usr/sbin /sbin /opt/X11/bin Where do i need to add it? in ~/.bashrc ?

derekstavis commented 8 years ago

hm, so we got into the point. what happens when you do nvm use 5.7.1? do PATH changes?

benmarten commented 8 years ago

no, it stays exactly the same ...

On Mar 7, 2016, at 5:23 PM, Derek Willian Stavis notifications@github.com wrote:

I updated nvm here and my install still works. This is my current PATH using the same node version:

⋊> ~/.l/s/o/p/nvm on master ● echo $PATH /Users/derek/.nvm/versions/node/v5.7.1/bin /Users/derek/.rvm/gems/ruby-2.2.1/bin /Users/derek/.rvm/gems/ruby-2.2.1@global/bin /Users/derek/.rvm/rubies/ruby-2.2.1/bin /usr/local/bin /usr/bin /bin /usr/sbin /sbin /opt/X11/bin /Library/TeX/texbin /Users/derek/.rvm/bin — Reply to this email directly or view it on GitHub https://github.com/derekstavis/plugin-nvm/issues/8#issuecomment-193543250.

derekstavis commented 8 years ago

Just to make sure: Have you installed nvm in fish using omf install nvm?

benmarten commented 8 years ago

Yes: ⋊> ~ omf install nvm 17:26:58 Error: package nvm already installed.

On Mar 7, 2016, at 5:29 PM, Derek Willian Stavis notifications@github.com wrote:

omf install nvm

benmarten commented 8 years ago

⋊> ~ omf uninstall nvm 17:29:44 nvm successfully removed. ⋊> ~ echo $PATH 17:30:59 /usr/local/bin /usr/bin /bin /usr/sbin /sbin /opt/X11/bin ⋊> ~ omf install nvm 17:31:14 Installing package nvm ✔ package nvm successfully installed. ⋊> ~ nvm use 5.7.1 17:31:18 Now using node v5.7.1 (npm v3.6.0) ⋊> ~ echo $PATH 17:31:22 /usr/local/bin /usr/bin /bin /usr/sbin /sbin /opt/X11/bin

derekstavis commented 8 years ago

Cool. This is the perfect log! :ok_hand:

It looks to me that there's something with your environment that is breaking foreign-env plugin. Asking you to paste your environment isn't a good idea as there is sensitive information there. So please, let me step once more into the bug.

Please let's check how this is working for you:

⋊> ~/.l/s/o/p/nvm on master ● echo $nvm_prefix
/usr/local/opt/nvm

⋊> ~/.l/s/o/p/nvm on master ● echo $NVM_PATH
/Users/derek/.nvm/versions/node/v5.7.1/lib/node

⋊> ~/.l/s/o/p/nvm on master ● echo $NVM_DIR
/Users/derek/.nvm

If this variables exist and point to the right places also past the output of this:

⋊> ~/.l/s/o/p/nvm on master ● fenv source $nvm_prefix/nvm.sh\; nvm use 5\; echo \$NVM_PATH
Now using node v5.7.1 (npm v3.6.0)
/Users/derek/.nvm/versions/node/v5.7.1/lib/node

⋊> ~/.l/s/o/p/nvm on master ● fenv source $nvm_prefix/nvm.sh\; nvm use 5\; echo \$PATH
Now using node v5.7.1 (npm v3.6.0)
/Users/derek/.nvm/versions/node/v5.7.1/bin:/Users/derek/.rvm/gems/ruby-2.2.1/bin:/Users/derek/.rvm/gems/ruby-2.2.1@global/bin:/Users/derek/.rvm/rubies/ruby-2.2.1/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/Library/TeX/texbin:/Users/derek/.rvm/bin
benmarten commented 8 years ago

$NVM_PATH is empty, the other two exist and seem correct

derekstavis commented 8 years ago

Could you paste the output of the other two commands? :microscope:

benmarten commented 8 years ago

ok, here is the full output of all:

⋊> ~ echo $nvm_prefix                                                                                                                                                                               17:46:21
/usr/local/opt/nvm
⋊> ~ echo $NVM_PATH                                                                                                                                                                                 17:46:44

⋊> ~ echo $NVM_DIR                                                                                                                                                                                  17:46:49
/Users/Ben/.nvm
⋊> ~ fenv source $nvm_prefix/nvm.sh\; nvm use 5\; echo \$NVM_PATH                                                                                                                                   17:46:53
Now using node v5.7.1 (npm v3.6.0)
/Users/Ben/.nvm/versions/node/v5.7.1/lib/node
⋊> ~ fenv source $nvm_prefix/nvm.sh\; nvm use 5\; echo \$PATH                                                                                                                                       17:47:02
Now using node v5.7.1 (npm v3.6.0)
/Users/Ben/.nvm/versions/node/v5.7.1/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin
derekstavis commented 8 years ago

Definitely a bug in foreign-env plugin. Probably a characteristic of your environment (the output of env) is breaking foreign-env algorithm. I'm to rewrite this algorithm for quite some time. I will take a look at it and I come back here as soon as I rewrite the environment diff code to test your environment. Please hold on tight!

pgbytes commented 8 years ago

I have kind of same problem.

I installed nvm and the output was:

⋊> ~ omf install nvm                                                                                                                                                                                                                                                    14:43:23
Installing package nvm
Installing package foreign-env
✔ package foreign-env successfully installed.
✔ package nvm successfully installed.
getopt: illegal option -- q

then I perform a refresh and get this:

⋊> ~ refresh                                                                                                                                                                                                                                                            14:48:09
read: Unknown option 'caller'
/Users/pgupta/.local/share/omf/pkg/omf/functions/compat/refresh.fish (line 2): echo (status -t)[5] | read -la caller
                                                                               ^
in function 'refresh',
    called on standard input,

then

⋊> ~ nvm install 4.4.1                                                                                                                                                                                                                                                  15:40:25
getopt: illegal option -- q
You need to install foreign-env plugin
derekstavis commented 4 years ago

Closing for inactivity