hook.io icon indicating copy to clipboard operation
hook.io copied to clipboard

Module install fails when requiring from module relative paths

Open joshgillies opened this issue 9 years ago • 1 comments

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').

joshgillies avatar Aug 26 '15 04:08 joshgillies

Good catch!

Shouldn't be too hard to fix. Just need to check for / and remove anything after it from the module check.

Marak avatar Aug 26 '15 04:08 Marak