Undefined pkg variable in node_modules\npm\lib\unbuild.js:62 #17865
Comments
+1 For me pkg.name is undefined, so I added additional check to Kevin fix and it works. |
I think this is the same issue as #17858 |
I am not 100% sure but I think I started seeing this issue after using (a probably very outdated version of) N to install a recent version of node. I tried completely removing node and npm, reinstalling, and re-upgrading to the latest npm...
Even a simple
Based on the comments above, here's what ended up working for me: var parent;
if (typeof pkg !== 'undefined' && typeof pkg.name !== 'undefined') {
parent = pkg.name[0] === '@' ? path.dirname(path.dirname(folder)) : path.dirname(folder)
} else {
parent = path.dirname(folder)
} I don't know where the undefined package name is coming from. Would be happy to help debug if someone wants to get in touch sooner rather than later (before all of the context falls out of my brain)... But for now I'm back on my feet. |
I'm seeing similar behaviour on Linux, but not on MacOS. Using Node 8.5.0 and NPM 5.3.0. It has worked once on Linux, but seeing lots of this:
|
unbuild.js is still broken in 5.5.1 Is there a version that has a fix? For now I will patch source as shown above. |
Updating npm helped. In case one uses nvm here is how to do that. |
I'm opening this issue because:
What's going wrong?
When installing packages:
How can the CLI team reproduce the problem?
supporting information:
npm -v
prints: 5.3.0node -v
prints: v6.10.2npm config get registry
prints: https://registry.npmjs.org/Windows, OS X/macOS, or Linux?: Windows
My temporary fix
Go to lib\unbuild.js:62
Find
parent = pkg.name[0] === '@' ? path.dirname(path.dirname(folder)) : path.dirname(folder)
Replace with
The text was updated successfully, but these errors were encountered: