Closed
Description
What / Why
npm link ../doesnt-exist
, which is completely invalid syntax, gives a weird error:
npm ERR! code EINVALIDTYPE
npm ERR! typeerror Error: Argument #2: Expected array but got string
npm ERR! typeerror at EventEmitter.install (/home/faux/.npm-packages/lib/node_modules/npm/lib/install.js:195:3)
npm ERR! typeerror at Object.commandCache.(anonymous function) (/home/faux/.npm-packages/lib/node_modules/npm/lib/npm.js:156:13)
npm ERR! typeerror at /home/faux/.npm-packages/lib/node_modules/npm/lib/link.js:93:24
npm ERR! typeerror at callback (/home/faux/.npm-packages/lib/node_modules/npm/node_modules/graceful-fs/polyfills.js:295:20)
npm ERR! typeerror at FSReqWrap.oncomplete (fs.js:153:21)
When
Always, even outside a project, target path is valid or not, etc.
I do have linked projects on my system, and a registry, and a cache, and a prefix.
//registry.npmjs.org/:_authToken=${NPM_TOKEN}
cache=/home/faux/.cache/npm
prefix=/home/faux/.npm-packages
Expected Behavior
I had remembered that this was the syntax to link the module at a path. It is not.
I don't even think it should be. I just happened to run it.
I meant to run:
cd ../doesnt-exist
npm link
cd -
npm link doesnt-exist
Log
0 info it worked if it ends with ok
1 verbose cli [ '/usr/bin/node',
1 verbose cli '/home/faux/.npm-packages/bin/npm',
1 verbose cli 'link',
1 verbose cli '../doesnt-exist' ]
2 info using [email protected]
3 info using [email protected]
4 verbose npm-session 71d8617c042c4a73
5 verbose stack Error: Argument #2: Expected array but got string
5 verbose stack at EventEmitter.install (/home/faux/.npm-packages/lib/node_modules/npm/lib/install.js:195:3)
5 verbose stack at Object.commandCache.(anonymous function) (/home/faux/.npm-packages/lib/node_modules/npm/lib/npm.js:156:13)
5 verbose stack at /home/faux/.npm-packages/lib/node_modules/npm/lib/link.js:93:24
5 verbose stack at callback (/home/faux/.npm-packages/lib/node_modules/npm/node_modules/graceful-fs/polyfills.js:295:20)
5 verbose stack at FSReqWrap.oncomplete (fs.js:153:21)
6 verbose cwd /var/tmp/faux191128.omelette
7 verbose Linux 5.3.0-23-generic
8 verbose argv "/usr/bin/node" "/home/faux/.npm-packages/bin/npm" "link" "../doesnt-exist"
9 verbose node v10.16.3
10 verbose npm v6.13.1