Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

npm link not working on Node 6 #814

Closed
jamestalmage opened this issue May 7, 2016 · 2 comments
Closed

npm link not working on Node 6 #814

jamestalmage opened this issue May 7, 2016 · 2 comments

Comments

@jamestalmage
Copy link
Contributor

To debug, I added the following statements to a number of internal AVA files:

console.log(__filename);

On Node 5, when everything works, I get this output:

/~/dev/ava/lib/fork.js
/~/dev/ava/lib/test-worker.js
/~/dev/ava/lib/test-worker.js
/~/dev/ava/lib/test-worker.js
/~/dev/ava/lib/test-worker.js
/~/dev/ava/index.js
/~/dev/ava/index.js
/~/dev/ava/index.js
/~/dev/ava/index.js
/~/dev/ava/index.js

On Node 6, where things are broken:

/~/dev/ava-codemods/node_modules/ava/lib/fork.js
/~/dev/ava/lib/test-worker.js
/~/dev/ava/lib/test-worker.js
/~/dev/ava/lib/test-worker.js
/~/dev/ava/lib/test-worker.js
/~/dev/ava-codemods/node_modules/ava/index.js
/~/dev/ava-codemods/node_modules/ava/index.js
/~/dev/ava-codemods/node_modules/ava/index.js
/~/dev/ava-codemods/node_modules/ava/index.js
/~/dev/ava-codemods/node_modules/ava/lib/test-worker.js
/~/dev/ava-codemods/node_modules/ava/lib/test-worker.js
/~/dev/ava-codemods/node_modules/ava/lib/test-worker.js
/~/dev/ava-codemods/node_modules/ava/index.js
/~/dev/ava-codemods/node_modules/ava/lib/test-worker.js

So, it appears that, in Node 6, npm linked modules think they are inside the node_modules folder of the project from which they are linked, instead of their actual path on the file system.

However, when we fork test-worker.js, it is aware of it's actual path. But that gets confused when when the user does require('ava') and the file paths show as nested again.

You will notice test-worker shows up twice as often as it should, with a deeper path the second time around.

@jamestalmage
Copy link
Contributor Author

The new behavior is intentional: nodejs/node#5950

But problematic when calling fork.

@jamestalmage
Copy link
Contributor Author

There is an open PR to revert the change: nodejs/node#6537

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants