Monday, 1 May 2017

Node module with Helper file results in 'cannot find module' error when installed

Apologies in advance, I'm sure there's a simple answer in an obvious thread I've just failed to find it/understand it.

Given a node.js module Jimmy implemented in the global node_modules/Jimmy/index.js file; I have a few 'helper' functions that I put in a separate Helper.js file, all in the same directory. Works great when I run a sample program requireing it from the same directory, but running that same sample program from anywhere else, it fails to load the supporting Helper.js file:

    Error: Cannot find module 'Helper'

Can someone explain or point me to an explanation of why this doesn't work and what I should be doing to make it work?

Thanks ...



via kov

No comments:

Post a Comment