Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nvm should create etc/ directory for installations #634

Closed
smikes opened this issue Jan 28, 2015 · 5 comments
Closed

nvm should create etc/ directory for installations #634

smikes opened this issue Jan 28, 2015 · 5 comments
Assignees
Labels
bugs Oh no, something's broken :-( installing node Issues with installing node/io.js versions.

Comments

@smikes
Copy link

smikes commented Jan 28, 2015

Noticed with 0.23.2, io.js 1.0.4 ; when I try to run npm config edit --global npm tries to spawn vim on ${NVM_PATH}/../../etc/npmrc ; but since the etc subdirectory of v1.0.4 does not exists, npm writes an unpleasant error message:

$ npm config edit --global
npm ERR! Darwin 14.1.0
npm ERR! argv "node" "/Users/smikes/.nvm/versions/io.js/v1.0.4/bin/npm" "config" "edit" "--global"
npm ERR! node v1.0.4
npm ERR! npm  v2.3.0
npm ERR! path /Users/smikes/.nvm/versions/io.js/v1.0.4/etc/npmrc.c33db61dc6e13a89a2ab11f8f1793b9e
npm ERR! code ENOENT
npm ERR! errno -2

npm ERR! enoent ENOENT, open '/Users/smikes/.nvm/versions/io.js/v1.0.4/etc/npmrc.c33db61dc6e13a89a2ab11f8f1793b9e'
npm ERR! enoent This is most likely not a problem with npm itself
npm ERR! enoent and is related to npm not being able to find a file.
npm ERR! enoent 

npm ERR! Please include the following file with any support request:
npm ERR!     /Users/smikes/src/github/npm-kludge-search/npm-debug.log

See issue npm/npm#7233 (for improving the npm error message); this case requests that the etc/ directory be created on install.

@ljharb
Copy link
Member

ljharb commented Jan 28, 2015

Related to #606.

I see no problem with nvm mkdir -ping that directory, but I don't understand why npm isn't doing that itself. Or is that something that the node/iojs installer is supposed to be doing?

@ljharb ljharb added bugs Oh no, something's broken :-( installing node Issues with installing node/io.js versions. labels Jan 28, 2015
@ljharb ljharb self-assigned this Jan 28, 2015
@smikes
Copy link
Author

smikes commented Jan 28, 2015

I would put this on the installer. In general I expect that if <path>/bin/node exists and <path>/lib exists that it's reasonable that <path>/etc also should exist; that feels like a Unix convention even if it's not in any standard.

However, if npm creates the lib directory then I would be convinced the other day. I think npm expects the bin lib and etc directories to already exist when it installs a global package. (Possibly man too...)

@ljharb
Copy link
Member

ljharb commented Jan 31, 2015

nvm does nothing except run the node/iojs installer - so I think it's a combo issue:

  1. the node/iojs installer may need to create the etc dir
  2. npm should absolutely create the dir it needs when attempting to edit a config file

I'm not convinced it's a good idea to add && mkdir -p "$(nvm_version_path "$(nvm current)")/etc" to the install (or perhaps use) code path. While it would solve your issue for nvm, I'm not sure it's the right place to solve it.

Thoughts?

@smikes
Copy link
Author

smikes commented Feb 2, 2015

I agree with your points above. nvm does have the best leverage to address this bug across both io.js/node and across various npm versions, but it really isn't in any way an nvm bug.

@ljharb
Copy link
Member

ljharb commented Feb 17, 2015

Fixed with npm/npm#7249

@ljharb ljharb closed this as completed Feb 17, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bugs Oh no, something's broken :-( installing node Issues with installing node/io.js versions.
Projects
None yet
Development

No branches or pull requests

2 participants