clux / symlink

npm link helper for npm@^2
MIT License
33 stars 6 forks source link

not working with npm >= 3 #7

Open clux opened 8 years ago

clux commented 8 years ago

Something has changed with npm3 and link. It's being picky about what can be symlinked, and in larger setups such as tournament-dev world, it seems to never work anymore.

https://github.com/clux/tournament-dev/issues/1

clux commented 8 years ago

hunch: npm is also linking in the dependencies of a module you're linking in, and it will get confused when it doesn't find them in the same folder.

clux commented 8 years ago

Smallest reproducible set I have found:

Clone 5 repos from clux:

Cloning into 'bandage'...
Cloning into 'smell'...
Cloning into 'ffa'...
Cloning into 'tiebreaker'...
Cloning into 'tournament'...

Try to link them together fully:

$ symlink ~/repos
cd /root/repos/bandage && npm install co equals minimist object-inspect stack-trace istanbul
cd /root/repos/bandage && npm link
cd /root/repos/smell && npm link bandage
cd /root/repos/smell && npm install istanbul
cd /root/repos/smell && npm link
cd /root/repos/tournament && npm link bandage
cd /root/repos/tournament && npm install interlude istanbul
cd /root/repos/tournament && npm link
cd /root/repos/ffa && npm link tournament bandage smell
cd /root/repos/ffa && npm install interlude group istanbul
cd /root/repos/ffa && npm link
cd /root/repos/tiebreaker && npm link tournament bandage ffa smell
cd /root/repos/tiebreaker && npm install interlude groupstage istanbul
cd /root/repos/tiebreaker && npm link

Running these commands (pipe symlink ~/repos to bash) will fail at the last install stage in tiebreaker:

Command failed: /bin/sh -c cd /root/repos/tiebreaker && npm install interlude groupstage istanbul
npm WARN skippingAction Module is inside a symlinked module: not running remove bandage@0.4.1 node_modules/ffa/node_modules/bandage
npm WARN skippingAction Module is inside a symlinked module: not running remove jkroso-type@1.1.1 node_modules/ffa/node_modules/jkroso-type
npm WARN skippingAction Module is inside a symlinked module: not running remove smell@2.0.6 node_modules/ffa/node_modules/smell
npm WARN skippingAction Module is inside a symlinked module: not running remove bandage@0.4.1 node_modules/smell/node_modules/bandage
npm WARN skippingAction Module is inside a symlinked module: not running remove bandage@0.4.1 node_modules/tournament/node_modules/bandage
npm ERR! Linux 3.13.0-24-generic
npm ERR! argv "/root/local/node-v5.2.0/bin/node" "/root/local/node/bin/npm" "install" "interlude" "groupstage" "istanbul"
npm ERR! node v5.2.0
npm ERR! npm  v3.3.12
npm ERR! path /root/repos/tiebreaker/node_modules/escodegen/node_modules/esprima/bin/esparse.js
npm ERR! code ENOENT
npm ERR! errno -2
npm ERR! syscall chmod

npm ERR! enoent ENOENT: no such file or directory, chmod '/root/repos/tiebreaker/node_modules/escodegen/node_modules/esprima/bin/esparse.js'
npm ERR! enoent This is most likely not a problem with npm itself
npm ERR! enoent and is related to npm not being able to find a file.
npm ERR! enoent 

npm ERR! Please include the following file with any support request:
npm ERR!     /root/repos/tiebreaker/npm-debug.log

There's also a ton of skippingAction warnings because Module is inside a symlinked module.

clux commented 8 years ago

With only 4 repositories (but significantly less warnings):

git clone https://github.com/clux/smell
git clone https://github.com/clux/ffa
git clone https://github.com/clux/tiebreaker
git clone https://github.com/clux/tournament
cd ~/repos/smell && npm install bandage istanbul
cd ~/repos/smell && npm link
cd ~/repos/tournament && npm install interlude bandage istanbul
cd ~/repos/tournament && npm link
cd ~/repos/ffa && npm link tournament smell
cd ~/repos/ffa && npm install interlude group bandage istanbul
cd ~/repos/ffa && npm link
cd ~/repos/tiebreaker && npm link tournament ffa smell
cd ~/repos/tiebreaker && npm install interlude groupstage bandage istanbul
cd ~/repos/tiebreaker && npm link

error:

npm ERR! Linux 3.13.0-24-generic
npm ERR! argv "/root/local/node-v5.2.0/bin/node" "/root/local/node/bin/npm" "install" "interlude" "groupstage" "bandage" "istanbul"
npm ERR! node v5.2.0
npm ERR! npm  v3.3.12
npm ERR! path /root/repos/tiebreaker/node_modules/escodegen/node_modules/esprima/bin/esparse.js
npm ERR! code ENOENT
npm ERR! errno -2
npm ERR! syscall chmod

npm ERR! enoent ENOENT: no such file or directory, chmod '/root/repos/tiebreaker/node_modules/escodegen/node_modules/esprima/bin/esparse.js'
npm ERR! enoent This is most likely not a problem with npm itself
npm ERR! enoent and is related to npm not being able to find a file.
npm ERR! enoent 

npm ERR! Please include the following file with any support request:
npm ERR!     /root/repos/tiebreaker/npm-debug.log
clux commented 8 years ago

With only 3 repositories:

git clone https://github.com/clux/smell
git clone https://github.com/clux/ffa
git clone https://github.com/clux/tiebreaker
cd /root/repos/smell && npm install bandage istanbul
cd /root/repos/smell && npm link
cd /root/repos/ffa && npm link smell
cd /root/repos/ffa && npm install interlude group tournament bandage istanbul
cd /root/repos/ffa && npm link
cd /root/repos/tiebreaker && npm link ffa smell
cd /root/repos/tiebreaker && npm install interlude tournament groupstage bandage istanbul

Fails with:

Command failed: /bin/sh -c cd /root/repos/tiebreaker && npm install interlude tournament groupstage bandage istanbul
npm WARN skippingAction Module is inside a symlinked module: not running remove smell@2.0.6 node_modules/ffa/node_modules/smell
npm ERR! Linux 3.13.0-24-generic
npm ERR! argv "/root/local/node-v5.2.0/bin/node" "/root/local/node/bin/npm" "install" "interlude" "tournament" "groupstage" "bandage" "istanbul"
npm ERR! node v5.2.0
npm ERR! npm  v3.3.12
npm ERR! path /root/repos/tiebreaker/node_modules/escodegen/node_modules/esprima/bin/esparse.js
npm ERR! code ENOENT
npm ERR! errno -2
npm ERR! syscall chmod

npm ERR! enoent ENOENT: no such file or directory, chmod '/root/repos/tiebreaker/node_modules/escodegen/node_modules/esprima/bin/esparse.js'
npm ERR! enoent This is most likely not a problem with npm itself
npm ERR! enoent and is related to npm not being able to find a file.
npm ERR! enoent 

npm ERR! Please include the following file with any support request:
npm ERR!     /root/repos/tiebreaker/npm-debug.log
clux commented 8 years ago

Without symlink magic:

git clone https://github.com/clux/smell
git clone https://github.com/clux/ffa
git clone https://github.com/clux/tiebreaker
cd smell
npm install
npm link
cd ../ffa
npm link smell
npm install
npm link
cd ../tiebreaker
npm link smell ffa
npm install

Error:

npm ERR! Linux 3.13.0-24-generic
npm ERR! argv "/home/clux/local/node-v5.2.0/bin/node" "/home/clux/local/node/bin/npm" "install"
npm ERR! node v5.2.0
npm ERR! npm  v3.3.12
npm ERR! path /home/clux/testrepos/tiebreaker/node_modules/escodegen/node_modules/esprima/bin/esparse.js
npm ERR! code ENOENT
npm ERR! errno -2
npm ERR! syscall chmod

npm ERR! enoent ENOENT: no such file or directory, chmod '/home/clux/testrepos/tiebreaker/node_modules/escodegen/node_modules/esprima/bin/esparse.js'
npm ERR! enoent This is most likely not a problem with npm itself
npm ERR! enoent and is related to npm not being able to find a file.
npm ERR! enoent 

npm ERR! Please include the following file with any support request:
npm ERR!     /home/clux/testrepos/tiebreaker/npm-debug.log

Can prove this is an npms fault by continuing:

rm -rf node_modules # inside tiebreaker still
npm install # i.e. without the linked modules

passes.

clux commented 8 years ago

Raised an issue at npm over this https://github.com/npm/npm/issues/10800

clux commented 8 years ago

original issue is somewhat lessened by npm@3.7, but I'm still having exclusive link related failures with that npm version. See https://github.com/clux/tournament-dev/issues/1

clux commented 8 years ago

FYI for subscribers.

Tried a full symlink setup with npm@3.9.6 since npm closed the bug, and while it's better, it still failed.

Command failed: /bin/sh -c cd /home/clux/repos/tournament/autonomy && npm install istanbul
npm WARN deprecated minimatch@2.0.10: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN skippingAction Module is inside a symlinked module: not running move @jkroso/type@1.1.1 node_modules/@jkroso/type
npm WARN skippingAction Module is inside a symlinked module: not running move co@4.6.0 node_modules/co
npm WARN skippingAction Module is inside a symlinked module: not running move equals@1.1.0 node_modules/equals
npm WARN skippingAction Module is inside a symlinked module: not running move object-inspect@1.2.1 node_modules/object-inspect
npm WARN skippingAction Module is inside a symlinked module: not running move stack-trace@0.0.9 node_modules/stack-trace
npm WARN skippingAction Module is inside a symlinked module: not running remove bandage@0.5.0 node_modules/operators/node_modules/bandage
npm ERR! code 1

Would still recommend npm@^2. Not really using npm@3 much anymore so probably won't bother testing this more for a while.

JohnWeisz commented 7 years ago

Same here, it's as if npm does not recognize some links, and instead tries to directly reference the package as specified in dependencies.

clux commented 7 years ago

Yeah, you can downgrade npm to version 2 using npm install -g npm@2 and symlink should still work.

Future functionality in here is likely going to be programmed against yarn than npm>=3.