Skip to content
This repository has been archived by the owner on Oct 30, 2024. It is now read-only.

Resolve path failed. #1

Closed
lygstate opened this issue Jan 26, 2019 · 3 comments
Closed

Resolve path failed. #1

lygstate opened this issue Jan 26, 2019 · 3 comments

Comments

@lygstate
Copy link

ERROR in ./node_modules/ref/lib/ref.js
Module not found: Error: Can't resolve './binding.node' in 'E:\CI-Cor\acrop\acrop\device\node_modules\ref\lib'
@ ./node_modules/ref/lib/ref.js 5:27-52
@ ./node/drivers/rs485/serial.ts
@ ./node/drivers/rs485/test-serial.ts

ERROR in ./node_modules/ffi/lib/bindings.js
Module not found: Error: Can't resolve './ffi_bindings.node' in 'E:\CI-Cor\acrop\acrop\device\node_modules\ffi\lib'
@ ./node_modules/ffi/lib/bindings.js 2:17-47
@ ./node_modules/ffi/lib/ffi.js
@ ./node/drivers/rs485/serial.ts
@ ./node/drivers/rs485/test-serial.ts

@lightsofapollo
Copy link

#2 Will fix this (or did for me anyway :))

@simonbuchan
Copy link
Owner

Sorry for the late reply, apparently you don't watch your own repos by default!

I think I see what's going on here, I've always used the code in the README to externalize the .node files, this means the bundle output looks like:

dist/main.js: ... require('./binding.node'); ... require('./ffi_bindings.node'); ...
dist/binding.node
dist/ffi_bindings.node

But if you don't use externals, including if you're using a loader like node-native-loader, this will actually break your output, as the relative path in the pre-bundle code is no longer valid!

The right fix is probably to just use the local file path as returned from bindings as the required statement, or at least a relative path to it, then tell you to also use node-native-loader, or one of the equivalents. This means the path option for bindings is useless of course, not sure what to do about that.

@lygstate
Copy link
Author

Yeap, this got be fixed.

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

No branches or pull requests

3 participants