Web3.js: npm install error - installing [email protected] in windows 10

Created on 19 Nov 2018  路  4Comments  路  Source: ChainSafe/web3.js

Currently I am using [email protected] and I can't use the promises to retrieve a list of unlocked accounts created by Ganache

I installed web3 by using npm by writing npm install web3, as written in the documentation of web3, but it installed web3 0.19.1

these are some snippets
screenshot 184
screenshot 185
screenshot 186

support

Most helpful comment

Hi @AhmedAdelFahmyHassanIbrahim, I am on windows aswell but I could not reproduce your issue.
I typed : npm install web3 then npm list web3
I have this output : [email protected]

I used Windows Powershell to install (if it can helps you).

Maybe this workaround can fix your error:

  • Change your package.json dependencies web3 to "latest"
  • npm install

All 4 comments

Hi @AhmedAdelFahmyHassanIbrahim. Have you checked out this similar issue? https://github.com/ethereum/web3.js/issues/1783#issuecomment-405650471

@nivida pasted a pretty detailed step by step guide to solving the installation issues on windows. Could you try that out and let me know if it solves your problem?

Hi @AhmedAdelFahmyHassanIbrahim, I am on windows aswell but I could not reproduce your issue.
I typed : npm install web3 then npm list web3
I have this output : [email protected]

I used Windows Powershell to install (if it can helps you).

Maybe this workaround can fix your error:

  • Change your package.json dependencies web3 to "latest"
  • npm install

@Huanzhang89 @Meabo @nivida now i have resolved the issue of 1.x . but still the mocha test fails executing the above code.
and generates an error like this:

[email protected] test C:\Users\S.Jaikrish\Desktop\ethereum\inbox
mocha

C:\Users\S.Jaikrish\Desktop\ethereum\inbox\node_modules\ganache-cli\build\lib.node.js:63898
var Module;if(!Module)Module=(typeof Module!=="undefined"?Module:null)||{};var moduleOverrides={};for(var key in Module){if(Module.hasOwnProperty(key)){moduleOverrides[key]=Module[key]}}var ENVIRONMENT_IS_WEB=false;var ENVIRONMENT_IS_WORKER=false;var ENVIRONMENT_IS_NODE=false;var ENVIRONMENT_IS_SHELL=false;if(Module["ENVIRONMENT"]){if(Module["ENVIRONMENT"]==="WEB"){ENVIRONMENT_IS_WEB=true}else if(Module["ENVIRONMENT"]==="WORKER"){ENVIRONMENT_IS_WORKER=true}else if(Module["ENVIRONMENT"]==="NODE"){ENVIRONMENT_IS_NODE=true}else if(Module["ENVIRONMENT"]==="SHELL"){ENVIRONMENT_IS_SHELL=true}else{throw new Error("The provided Module['ENVIRONMENT'] value is not valid. It must be one of: WEB|WORKER|NODE|SHELL.")}}else{ENVIRONMENT_IS_WEB=typeof window==="object";ENVIRONMENT_IS_WORKER=typeof importScripts==="function";ENVIRONMENT_IS_NODE=typeof process==="object"&&"function"==="function"&&!ENVIRONMENT_IS_WEB&&!ENVIRONMENT_IS_W

TypeError: core.addProviders is not a function
at Object. (C:\Users\S.Jaikrish\Desktop\ethereum\inbox\node_modules\web3\src\index.js:76:6)
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. (C:\Users\S.Jaikrish\Desktop\ethereum\inbox\test\Inbox.test.js:3:14)
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 C:\Users\S.Jaikrish\Desktop\ethereum\inbox\node_modulesmocha\libmocha.js:231:27
at Array.forEach ()
at Mocha.loadFiles (C:\Users\S.Jaikrish\Desktop\ethereum\inbox\node_modulesmocha\libmocha.js:228:14)
at Mocha.run (C:\Users\S.Jaikrish\Desktop\ethereum\inbox\node_modulesmocha\libmocha.js:514:10)
at Object. (C:\Users\S.Jaikrish\Desktop\ethereum\inbox\node_modulesmocha\bin_mocha:484:18)
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:191:16)
at bootstrap_node.js:612:3
npm ERR! code ELIFECYCLE
npm ERR! errno 7
npm ERR! [email protected] test: mocha
npm ERR! Exit status 7
npm ERR!
npm ERR! Failed at the [email protected] test script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\S.Jaikrish\AppData\Roaming\npm-cache_logs\2019-01-31T19_09_27_862Z-debug.log

please help!!

@jaikrish5 please ask this on StackOverflow.

Was this page helpful?
0 / 5 - 0 ratings