hokaccha / nodebrew

Node.js version manager
MIT License
1.06k stars 66 forks source link

Fail to "npm link" #30

Closed teppeis closed 9 years ago

teppeis commented 9 years ago
$ mkdir foo && cd foo
$ npm init
...
$ npm link
npm ERR! Darwin 14.0.0
npm ERR! argv "node" "/Users/teppeis/.nodebrew/current/bin/npm" "link"
npm ERR! node v0.10.32
npm ERR! npm  v2.1.8
npm ERR! path /Users/teppeis/.nodebrew/current/lib/node_modules/foo/package.json
npm ERR! code ENOENT
npm ERR! errno 34

npm ERR! enoent ENOENT, open '/Users/teppeis/.nodebrew/current/lib/node_modules/foo/package.json'
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/teppeis/foo/npm-debug.log
teppeis commented 9 years ago

After this error, symlink has been made but the path is not correct.

$ ll ~/.nodebrew/current/lib/node_modules/
lrwxr-xr-x   1 teppeis  staff    15 11 25 10:23 foo@ -> ../../../../foo
tgfjt commented 9 years ago

I'm also having same issue. nodebrew 0.7.5

$ npm link
npm ERR! Darwin 14.0.0
npm ERR! argv "node" "/Users/tgfjt/.nodebrew/current/bin/npm" "link"
npm ERR! node v0.10.32
npm ERR! npm  v2.1.7
npm ERR! path /Users/tgfjt/.nodebrew/current/lib/node_modules/generator-foobar/package.json
npm ERR! code ENOENT
npm ERR! errno 34

npm ERR! ENOENT, open '/Users/tgfjt/.nodebrew/current/lib/node_modules/generator-foobar/package.json'
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR!     <http://github.com/npm/npm/issues>

npm ERR! Please include the following file with any support request:
npm ERR!     /Users/tgfjt/workspace/boxbox/generator-foobar/npm-debug.log
deepsweet commented 9 years ago

same problem :(

watilde commented 9 years ago

How about updating npm version to run npm install -g npm? It seems to go well:

$ npm install -g npm
$ node -v && npm -v
v0.10.32
2.7.4
$ mkdir foo && cd foo
$ npm init
...
$ npm link
deepsweet commented 9 years ago

nope, I already have npm@2.7.4.

teppeis commented 9 years ago

@watilde reproduced in npm@2.7.4 and node@0.12.0

npm ERR! Darwin 14.1.0
npm ERR! argv "node" "/Users/teppei/.nodebrew/current/bin/npm" "link"
npm ERR! node v0.12.0
npm ERR! npm  v2.7.3
npm ERR! path /Users/teppei/.nodebrew/current/lib/node_modules/foo/package.json
npm ERR! code ENOENT
npm ERR! errno -2

npm ERR! enoent ENOENT, open '/Users/teppei/.nodebrew/current/lib/node_modules/foo/package.json'
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/teppei/tmp/foo/npm-debug.log
watilde commented 9 years ago

@deepsweet @teppeis thanks a lot for your tests, I've reported to npm/npm!

hokaccha commented 9 years ago

@watilde Thank you for supporting!

watilde commented 9 years ago

@hokaccha umm..it might should to make the same depth of path between node/version and current for fixing this issue.

current:

.nodebrew
  - current: symlink
  - node
    -version

fixed idea:

.nodebrew
  - current
    - node: symlink
  - node
    - version

refs the test case: https://github.com/npm/npm/pull/7730

watilde commented 9 years ago

(๑˃̵ᴗ˂̵)و Seems to fix for now on npm@2.7.5 by https://github.com/npm/npm/pull/7751

deepsweet commented 9 years ago

yeah, works fine for me :+1:

hokaccha commented 9 years ago

Thank you everyone!

tgfjt commented 9 years ago

:clap: