hook.io
hook.io copied to clipboard
Module install fails when requiring from module relative paths
Uncovered this issue when trying to use: https://github.com/devongovett/jpg-stream.
Their API suggests requiring their JPEG encoder / decoder via a module relative path. Eg: require('jpg-stream/decoder')
.
In cases like this, hook.io tries to install jpg-stream/decoder
which isn't a valid package in the npm registry.
A workaround is to first require('jpg-stream')
, run the hook, then require the decoder via require('jpg-stream/decoder')
.
Good catch!
Shouldn't be too hard to fix. Just need to check for /
and remove anything after it from the module check.