简体   繁体   中英

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 do not suggest installation of package I have already done that but in this case I want to require sourcing the folder)

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

根据文档,该节点正在尝试执行以下操作: require

您应该在全局安装此npm模块。

npm install unirest -g

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM