Ethereum Web3.js returns "Cannot find module 'web3-requestManager'"

I am trying to start using Ethereum Web3.js with node 6.11.1 on macosx

I installed web3 with the following command:

npm install web3

Then I run this seemingly simple node command:

Web3 = require ('web3');

Well, it returns the following error:

module.js:471 throw err; ^ Error: Cannot find module 'web3-requestManager' at Function.Module._resolveFilename (module.js:469:15) at Function.Module._load (module.js:417:25) at Module.require (module.js:497:17) at require (internal/module.js:20:19) at Object.<anonymous> (/Users/fremente/Dropbox/Influx Design/Web htdocs/ethereum/node_modules/web3/packages/web3-core/src/index.js:26:22) at Module._compile (module.js:570:32) at Object.Module._extensions..js (module.js:579:10) at Module.load (module.js:487:32) at tryModuleLoad (module.js:446:12) at Function.Module._load (module.js:438:3) 

it seems that this requires some module (for example, "web3-requestManager") that are not installed with the package.

Here is my .json package

 { "name": "ethereum", "version": "1.0.0", "description": "", "main": "index.js", "dependencies": { "ethereumjs-testrpc": "^4.0.1", "solc": "^0.4.13", "web3": "^1.0.0-beta2" }, "devDependencies": {}, "scripts": { "test": "echo \"Error: no test specified\" && exit 1" }, "author": "", "license": "ISC" } 

Any idea? Am I doing something wrong?

+9
source share
8 answers

The problem is related to the use of beta version of web3, which is unstable at the moment and is currently in heavy development. You have one of two options,

  • either use the stable version 0.23, I think, or something like that

  • or manually install all the necessary dependencies, I do not recommend this solution for a stable dapp, since the situation is currently unstable.

+5
source
 npm install ethereum/web3.js 

should solve your problem

+11
source

I solved this by deleting the node_modules folder, running npm install again and manually installing web3js in addition to the package.json list:

Add dependency on package.json

 "web3": "^1.0.0-beta.31" 

Rebuild Modules

 rm -rf node_modules npm install 

Install web3 manually

 npm install web3@1.0.0-beta.31 
+2
source

I ran into this problem: web3@1.0.0-beta.26

I fixed this problem by updating node from v6.11.3 to v8.9.4 .

I deleted the node_modules folder and ran: npm install to restore the modules.

I think web3 uses features that are only supported by node version 8.xx

0
source

I solved the web3-requestManager problem by web3-requestManager to version 1.0.0-beta.29 . He used to install 1.0.0-beta.2 .

0
source

Installing git on my Windows 10 computer helped. Dependencies are not installed properly without it. https://git-scm.com/downloads

0
source

I am currently using web3 version 1.0. And I also use macOS. If you use this version too, try this:

 Running npm install ethereum/web3.js 
0
source

npm install ethereum/web3.js fixed my problem.

Hope this works for you too.

0
source

Source: https://habr.com/ru/post/1270409/


All Articles