Attempting to install and getting Cannot read property '0' of undefined
Closed this issue · 1 comments
I am making the following call:
npm i -S react-sticky
and it returns the following:
npm ERR! Cannot read property '0' of undefined
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/cameronaziz/.npm/_logs/2017-10-26T03_56_08_475Z-debug.log
and the last lines of the log are:
127 silly unbuild react-sticky@6.0.1
128 info lifecycle react-sticky@6.0.1preuninstall: react-sticky@6.0.1uninstall: react-sticky@6.0.1
129 info lifecycle react-sticky@6.0.1
130 verbose unbuild rmStuff react-sticky@6.0.1 from /Users/cameronaziz/Development/any-game/node_modules
131 info lifecycle react-sticky@6.0.1postuninstall: react-sticky@6.0.1preuninstall: undefined
132 silly unbuild d
133 info lifecycle undefined
134 info lifecycle undefineduninstall: undefinedpreuninstall: undefined
135 silly unbuild es5-ext
136 info lifecycle undefined
137 info lifecycle undefineduninstall: undefinedpreuninstall: undefined
138 silly unbuild es6-iterator
139 info lifecycle undefined
140 info lifecycle undefineduninstall: undefinedpreuninstall: undefined
141 silly unbuild es6-symbol
142 info lifecycle undefined
143 info lifecycle undefined~uninstall: undefined
144 verbose unlock done using /Users/cameronaziz/.npm/_locks/staging-027b7bfb6a0aeb2c.lock for /Users/cameronaziz/Development/any-game/node_modules/.staging
145 verbose stack TypeError: Cannot read property '0' of undefined
145 verbose stack at rmStuff (/usr/local/lib/node_modules/npm/lib/unbuild.js:61:24)
145 verbose stack at tryCatcher (/usr/local/lib/node_modules/npm/node_modules/bluebird/js/release/util.js:16:23)
145 verbose stack at ret (eval at makeNodePromisifiedEval (/usr/local/lib/node_modules/npm/node_modules/bluebird/js/release/promisify.js:184:12), :13:39)
145 verbose stack at lifecycle.then.then (/usr/local/lib/node_modules/npm/lib/install/action/unbuild.js:12:12)
145 verbose stack at tryCatcher (/usr/local/lib/node_modules/npm/node_modules/bluebird/js/release/util.js:16:23)
145 verbose stack at Promise._settlePromiseFromHandler (/usr/local/lib/node_modules/npm/node_modules/bluebird/js/release/promise.js:512:31)
145 verbose stack at Promise._settlePromise (/usr/local/lib/node_modules/npm/node_modules/bluebird/js/release/promise.js:569:18)
145 verbose stack at Promise._settlePromise0 (/usr/local/lib/node_modules/npm/node_modules/bluebird/js/release/promise.js:614:10)
145 verbose stack at Promise._settlePromises (/usr/local/lib/node_modules/npm/node_modules/bluebird/js/release/promise.js:693:18)
145 verbose stack at Promise._fulfill (/usr/local/lib/node_modules/npm/node_modules/bluebird/js/release/promise.js:638:18)
145 verbose stack at /usr/local/lib/node_modules/npm/node_modules/bluebird/js/release/nodeback.js:42:21
146 verbose cwd /Users/cameronaziz/Development/any-game
147 verbose Darwin 17.0.0
148 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "i" "-S" "react-sticky"
149 verbose node v6.11.0
150 verbose npm v5.4.2
151 error Cannot read property '0' of undefined
152 verbose exit [ 1, true ]
The second log line 145 has reference to the following function in unbuild.js
where line 61 is the fourth line of this code :
function rmStuff (pkg, folder, cb) {
// if it's global, and folder is in {prefix}/node_modules,
// then bins are in {prefix}/bin
// otherwise, then bins are in folder/../.bin
var parent = pkg.name[0] === '@' ? path.dirname(path.dirname(folder)) : path.dirname(folder)
var gnm = npm.dir
// gnm might be an absolute path, parent might be relative
// this checks they're the same directory regardless
var top = path.relative(gnm, parent) === ''
log.verbose('unbuild rmStuff', pkg._id, 'from', gnm)
if (!top) log.verbose('unbuild rmStuff', 'in', parent)
asyncMap([rmBins, rmMans], function (fn, cb) {
fn(pkg, folder, parent, top, cb)
}, cb)
}
What am I doing incorrectly?
Looks like an issue with npm npm/npm#17858