request / request-promise

The simplified HTTP request client 'request' with Promise support. Powered by Bluebird.
ISC License
4.76k stars 297 forks source link

Cannot find module 'request-promise-core/configure/request2' #278

Closed code-brewer closed 5 years ago

code-brewer commented 6 years ago

Help~ I have try many times but got same error!

I install by use follow comomand: npm install --save request npm install --save request-promise

My javascript file content is:

_var request = require('request-promise')

var options = {
    method: 'POST',
    uri: 'http://localhost:50001',
    body: {
        "jsonrpc": "2.0",
        "method": "eth_blockNumber",
        "params": [],
        "id": 3
    },
    json: true 
}

request(options)
    .then(function (response) {
      console.log("Got: ", response)
    })
    .catch(function (err) {
      console.log("err: ", err)
    })

Then,run: node "myProjectPathXXX/use_http_promise.js" module.js:549 throw err; ^

Error: Cannot find module 'request-promise-core/configure/request2' at Function.Module._resolveFilename (module.js:547:15) at Function.Module._load (module.js:474:25) at Module.require (module.js:596:17) at require (internal/module.js:11:18) at Object. (myProjectPathXXX/node_modules/_request-promise@4.2.2@request-promise/lib/rp.js:4:17) at Module._compile (module.js:652:30) at Object.Module._extensions..js (module.js:663:10) at Module.load (module.js:565:32) at tryModuleLoad (module.js:505:12) at Function.Module._load (module.js:497:3) at Module.require (module.js:596:17) at require (internal/module.js:11:18) at Object. at Object. (myProjectPathXXX/use_http_promise.js:1:77) at Module._compile (module.js:652:30) at Object.Module._extensions..js (module.js:663:10) at Module.load (module.js:565:32) at tryModuleLoad (module.js:505:12) at Function.Module._load (module.js:497:3) at Function.Module.runMain (module.js:693:10) at startup (bootstrap_node.js:188:16) at bootstrap_node.js:609:3

From package.json I saw version : "request": "^2.87.0", "request-promise": "^4.2.2"

analog-nico commented 5 years ago

I am actually a bit puzzled as of why the code can’t be found. It should be installed automatically by npm with request-promise. Are you using a different package manager? Anyways...

The code you are looking for is in the request-promise-core package.

Since your question is old I assume that you found a solution or moved on. Feel free to reopen if you still need a fix.