#53038 closed submission (fixed)
nvm @0.32.1: New port submission
Reported by: | coditect (Nicholas Rawlings) | Owned by: | Franklin Yu <franklinyu@…> |
---|---|---|---|
Priority: | Normal | Milestone: | |
Component: | ports | Version: | |
Keywords: | Cc: | ci42 | |
Port: | nvm |
Description
I have created a Portfile for NVM, a version manager for Node. It differs from a normal install of NVM in the following ways:
- NVM and NVM-managed version of Node are stored in
$prefix/lib/nvm
instead of~/.nvm
- NVM does not need to be initialized in
~/.profile
. Instead, a script stored at$prefix/bin/nvm
intercepts calls tonvm
, and runsnvm.sh
before passing control to thenvm()
shell function. This process is less efficient, but greatly simplifies the use of NVM withsudo
and multiple user accounts.
Suggestions and criticisms are greatly appreciated!
Attachments (2)
Change History (9)
comment:1 follow-ups: 2 4 Changed 8 years ago by ryandesign (Ryan Carsten Schmidt)
Cc: | ci42 added |
---|
comment:2 follow-up: 3 Changed 8 years ago by ryandesign (Ryan Carsten Schmidt)
Replying to ryandesign:
Is there a specific reason why you wrote code to write a file? Usually, we put such files in the files directory and just copy them.
I see you use some variables in the script. Typically, we handle that by putting a @PLACEHOLDER@
in the file in the files directory, and then after you copy it to the right place, you can use reinplace
to replace the placeholder with the real value.
I also see the script runs nvm using nvm $@
. That won't work for arguments containing spaces. You need nvm "$@"
.
Changed 8 years ago by coditect (Nicholas Rawlings)
comment:3 Changed 8 years ago by coditect (Nicholas Rawlings)
Replying to ryandesign: Thanks for the feedback, Ryan. I uploaded a new version of the Portfile that incorporates your suggestions.
I agree that leaving behind the contents of $prefix/lib/nvm/alias
, $prefix/lib/nvm/.cache
, and $prefix/lib/nvm/versions
after uninstalling the port is undesirable. Is there any way to instruct MacPorts that those folders should be expunged during a port uninstall
?
comment:4 Changed 8 years ago by coditect (Nicholas Rawlings)
Replying to ryandesign:
Regarding the appropriateness of providing a port for nvm: I think a cleaner solution would be to allow multiple nodejs*
ports to be installed side-by-side (they currently conflict) and choosing the active version of node through port select
. I think the biggest difficulty with this approach would be switching between different versions of of npm and the node_modules
folder in tandem with node itself.
comment:5 Changed 8 years ago by coditect (Nicholas Rawlings)
I have discovered several issues with the way that I set up this nvm port. Perhaps most problematic is the inconsistencies between $prefix/lib/nvm
and a user's $PATH
caused by running nvm with sudo. I am abandoning work on this project for now and would like to retract my Portfile submission.
comment:6 Changed 8 years ago by mf2k (Frank Schima)
Resolution: | → wontfix |
---|---|
Status: | new → closed |
comment:7 Changed 5 years ago by Franklin Yu <franklinyu@…>
Owner: | set to Franklin Yu <franklinyu@…> |
---|---|
Resolution: | wontfix → fixed |
"openmaintainer" is not valid as the only maintainer. If nobody maintains the port, the correct value is "nomaintainer".
Is there a specific reason why you wrote code to write a file? Usually, we put such files in the files directory and just copy them.
It would be easier to follow if you put the code relating to the bash_completion variant into the bash_completion variant.
I'll leave it to Christoph to decide whether it is a good idea to provide a port for nvm. (The way its use will cause unregistered files to be installed in $prefix/lib/nvm is for example undesirable, but I realize npm already does something similar.)