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

Symlinks in node_modules cause ENOENT #547

Open
kaatt opened this issue Dec 14, 2020 · 2 comments
Open

Symlinks in node_modules cause ENOENT #547

kaatt opened this issue Dec 14, 2020 · 2 comments

Comments

@kaatt
Copy link

kaatt commented Dec 14, 2020

I have a symlinked dependency installed with yarn (link:../packages/foo), foo has another symlinked dependency bar.

When I run electron-rebuild, I get:

✖ Rebuild Failed

An unhandled error occurred inside electron-rebuild
ENOENT: no such file or directory, stat '/Users/kaatt/Code/packages/foo/node_modules/bar'

Error: ENOENT: no such file or directory, stat '/Users/kaatt/Code/packages/foo/node_modules/bar'

This doesn't go away until I delete the bar symlink.

@malept
Copy link
Member

malept commented Dec 14, 2020

It would help if you could provide a concrete example with detailed repro steps, so we can use that to try to create a testcase inside the electron-rebuild testsuite.

@kaatt
Copy link
Author

kaatt commented Dec 18, 2020

I figured out it works if the symlink is correct but not if it's invalid.

The bug here is that it's traversing node_modules in the parent folder even when --module-dir is present.

mkdir -p foo/app
cd foo
echo "{}" > package.json
echo "{}" > app/package.json
mkdir node_modules
mkdir app/node_modules
ln -s ./NONEXISTENT node_modules/bar
electron-rebuild --module-dir app/

###
✖ Rebuild Failed

An unhandled error occurred inside electron-rebuild
ENOENT: no such file or directory, stat '/Users/kaatt/Downloads/foo/node_modules/bar'

Error: ENOENT: no such file or directory, stat '/Users/kaatt/Downloads/foo/node_modules/bar'

Note that foo/node_modules contains the invalid symlink. foo/app/node_modules does not, yet electron-rebuild touches the parent directory.

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

No branches or pull requests

2 participants