Sunday, 14 May 2017

nodejs: Cannot find module error while trying to require unirest module

I have a unirest client folder among node modules.

On trying to require unirest:

var uniClient = require('unirest');

Following error appears:

module.js:472
throw err;
^

Error: Cannot find module 'unirest'

I also tried requiring as follows:

var uniClient = require('C:/node_modules/unirest');

But I get the following error:

module.js:472
    throw err;
    ^

Error: Cannot find module 'C:/workspace/postman/webServices/target/node_modules/unirest'

I have checked and the index.js for unirest client is placed in C:/workspace/postman/webServices/target/node_modules/unirest.

I need to know - either, what is the standard path to require the unirest client (kindly ignore the installation part because due to some constraints I am unable to do the installation in this case - I only have a folder)

  • or, which module to look in the unirest directory so that I can find the path to require the same.


via StillNestling

No comments:

Post a Comment