npm upgrade leads to Error: ENOENT, open '/Users/<username>/null' #5613
Comments
I can confirm this as I'm having the very same issue (same version numbers too). I'll also fallback to 1.4.16_0 |
I confirm that I have same issue on OS X 10.9.4 after upgrading to 1.4.20 using macports. npm cache clean or remove ~/.npm didn't work. Rolled back to 1.4.16 |
I'm getting the same error with npm 1.4.20 from MacPorts on OS X 10.9.4:
|
Same error for me with npm 1.4.20 on Macports on OS X 10.6.8. |
same for me, macports and osx 10.9.4 |
Hey guys, this is clearly a problem, and I haven't had time to dig into it yet (nor do I have MacPorts installed). Since it seems to be localized to MacPorts, is there a chance that one or more of you could raise this issue with MacPorts so they can start taking a look at it too? |
Created here https://trac.macports.org/ticket/44271 |
Thanks, @emirotin! |
* solution at the bottom* Well, I tried to trace the issue and found something strange happening with the submodule "npmconf" that is a dependancy of npm along with its own submodule "nopt". In npmconf:In the main file function afterExtras(er) {
...
validate(conf)
var cafile = conf.get('cafile') // <-- Problem here (should be null, and it's "/CWD/null"
if (cafile) {
return conf.loadCAFile(cafile, finalize)
}
... For infos, it seems the "conf" object gets messed up during the When I inspect that function, I get function validate (cl) {
...
nopt.clean(cl.root, configDefs.types) // <-- Messed up from null to a "/CWD/null" during this call
} Digging into nopt:Digging deeper. I finally found a problem with the module "nopt" function validatePath (data, k, val) {
if (val === true) return false
data[k] = path.resolve(String(val)) // <-- EWW ! in our case, val is null !
return true
} So here the null val is converted to "null" and resolved as a path... Solution:The bug in nopt has already been corrected ! We will have to wait for npmconf to update its dependancy (to 3.0.1 at least). Strange thing is that npmconf depends on "nopt": "~3.0.1" Meanwhile, a temporary solution is to edit:
At line 127: function validatePath (data, k, val) {
if (val === true) return false
if (val === null) return true // <-- ADD THIS LINE !
data[k] = path.resolve(String(val))
return true
} Voila. |
Clean solution:sudo port uninstall npm
sudo rm -rf /opt/local/lib/node_modules/npm/
sudo port install npm Damn, spent all this time looking for a bug when it was just a "old file and directory structure" colliding with the new install... Long story short, when upgrading (or uninstall and reinstall), some node_modules subdirectories of npm are not cleaned up and mix and mash with the new directory structure. Proof (for the one having the problem that still haven't applied the solution): |
I can confirm that @alkama solution worked for me. The bug is definitely related to the garbage directories. Ack! |
@alkama Do you want to mention this solution over on the MacPorts bug report? |
Thanks @Alkma, that works. |
Mac OSX 10.7.5, NPM 1.4.20 - can confirm @alkama 's solution worked. Thanks! |
I get the same issue on Ubuntu Linux: 0 info it worked if it ends with ok I have this package installed: |
Thanks @Alkma, that works. |
SOLUTION FOUND: See @alkama's solution below!
I'm getting this error log no matter what command I run, no matter what directory I start NPM in.
The actual path in the error is simply the CWD, followed by
/null
.All I've changed was an upgrade to npm version from
1.4.16_0
to1.4.20_0
via MacPorts. This is on OS X v10.9.4, MacPorts v2.3.1, Node v0.10.29.The only command that doesn't fail is
npm -v
. Evennpm -h
fails with the same error message.I've tried uninstalling and reinstalling NPM, but I get the same bizarre error. I tried to step down to 1.4.19, same error. Finally, downgrading back to 1.4.16 removed the issue completely.
Note: I have my global packages installed in a subfolder under my user account, via
.npmrc
-prefix
, so everything exceptnpm
itself is installed under my account.I'd be happy to help debug this, I just have no idea how to figure out where the error is happening.
The text was updated successfully, but these errors were encountered: