This repository has been archived by the owner. It is now read-only.

msys2 / scoped private packages will not npm link #8874

Closed
cchamberlain opened this Issue Jul 9, 2015 · 3 comments

Comments

Projects
None yet
2 participants
@cchamberlain

cchamberlain commented Jul 9, 2015

I've been having issues linking scoped packages recently. I'm not sure if it was the upgrade to npm@3 or the other recent upgrade to msys2 (was using msysgit prior). I know msys2 / cygwin / etc. is unsupported but I'm stuck with it at work and seems like it could be a valid bug on other platforms unless I'm overlooking something.

Issue was it was throwing regarding Cannot read property '0' of undefined because lib/link.js was attempting to compare path.resolve(folder, '..') === npm.globalDir. Since its a scoped package I'm linking, it needed to traverse up two levels instead and was effectively comparing npm.globalDir + '@tixinc' === npm.globalDir.

Here is pastebin of output from running npm link ../ext (where ext is private scoped module @tixinc/ext) - http://pastebin.com/raw.php?i=khHxFqzL

I was able to fix in this fork by adding a check to see if there is a private scoped module in the folder path, and if so, I run a second path.resolve to traverse up an extra level. Tested and working for me with a few different scoped package links. - master...cchamberlain:master

If this is msys2 specific I'm fine carrying on this fork since it's working for me, but if this can be of benefit I can squash the commits and cleanup the code for a pull request.

image

@iarna iarna added this to the 3.2.1 milestone Jul 9, 2015

@iarna iarna added the bug label Jul 9, 2015

@iarna

This comment has been minimized.

Show comment
Hide comment
@iarna

iarna Jul 9, 2015

Member

That's a 3.x bug for sure– I'll fix that for next weeks release! Thanks for catching this!

Member

iarna commented Jul 9, 2015

That's a 3.x bug for sure– I'll fix that for next weeks release! Thanks for catching this!

@cchamberlain

This comment has been minimized.

Show comment
Hide comment
@cchamberlain

cchamberlain Jul 9, 2015

Awesome, I'm relieved it is not specific to my FrankensteinOS. =]

Thanks!

cchamberlain commented Jul 9, 2015

Awesome, I'm relieved it is not specific to my FrankensteinOS. =]

Thanks!

iarna added a commit that referenced this issue Jul 17, 2015

iarna added a commit that referenced this issue Jul 17, 2015

@iarna

This comment has been minimized.

Show comment
Hide comment
@iarna

iarna Jul 20, 2015

Member

The fix for this landed in master with fdb360f and in 3.1.3.

Member

iarna commented Jul 20, 2015

The fix for this landed in master with fdb360f and in 3.1.3.

@iarna iarna closed this Jul 20, 2015

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.