Closed guidosegni closed 7 years ago
I'm having the same issue apparently, when i try to install the needed file manually i get only an older version
I am having same issue. @frozeman
having the same issue
It was a package renaming issue, i fixed in the latest beat.15
I just installed web3 today and I am also getting this issue. Is this already on npm?
Getting this error:
./~/web3/packages/web3-core/src/index.js
Module not found: Can't resolve 'web3-core-requestmanager' in '/Users/jefflau/Projects/dapps/meth-wallet/node_modules/web3/packages/web3-core/src'
Not sure what happened but the error disappeared. Maybe have something to do with metamask? After that error disappeared i couldn't get it working in metamask, but it works in Mist fine
@jefflau any idea of what might have fixed it? Getting this issue when I install truffle-contract
.
I forgot to publish this module. i published it, so the issue should go away.
Truffle is and should not using the latest web3.js 1.0 beta, as its -> beta :) @tcoulter you should definitely take look at it though :)
Looks like truffle-contract is looking for web3 internal packages by names no longer on the npm registry, I moved my web3 version from ^1.0.0-beta.17 to 1.0.0-beta.15, removed node_modules, and re-npm installed to fix.
That doesn't sound like a fix, and like i wrote truffle is probably not working with web3.js 1.0.0 yet
@frozeman I am still getting this error.
I think I found the problem. Checkout: https://github.com/yarnpkg/yarn/issues/711
Yarn doesn't handle nested node_modules
as npm does.
I added this in the .bashrc
NODE_PATH=${HOME}/node_modules
and the problem was solved.
@pcjose this somehow a workaround. I would like to keep all modules in my project directory. I've tried with:
NODE_PATH=<absolute-path-to-project-root>/node_modules
And it doesn't work. I found the following hack: https://github.com/yarnpkg/yarn/issues/711#issuecomment-260050154
Is there any clean way to tell yarn
to install / link all dependencies recursively?
@frozeman
Truffle is and should not using the latest web3.js 1.0 beta, as its -> beta :)
Just to clear up any issues here, we haven't switched to 1.0 yet (nothing we have should be using it now, or has in the past). But we will switch once released!
Unfortunately, I have this problem with beta18. I tried to use web3 inside an ionic app. The following errors I get:
Cannot find module "web3-core-requestmanager"
Error: Cannot find module "web3-core-requestmanager"
at webpackMissingModule (http://localhost:8100/build/vendor.js:116468:86)
at Object.<anonymous> (http://localhost:8100/build/vendor.js:116468:187)
at __webpack_require__ (http://localhost:8100/build/vendor.js:55:30)
at Object.module.exports.version (http://localhost:8100/build/vendor.js:116365:12)
at __webpack_require__ (http://localhost:8100/build/vendor.js:55:30)
at Object.191 (http://localhost:8100/build/main.js:44:63)
at __webpack_require__ (http://localhost:8100/build/vendor.js:55:30)
at Object.262 (http://localhost:8100/build/main.js:222:75)
at __webpack_require__ (http://localhost:8100/build/vendor.js:55:30)
at Object.213 (http://localhost:8100/build/main.js:163:73)
What should I do?
@stefanhuber
Please use npm install --save web3
instead of yarn add web3
as workaround of this bug!
Now, for webpack to work:
const { lstatSync, readdirSync } = require('fs');
const { join } = require('path');
// is directory
const isDirectory = source => lstatSync(source).isDirectory();
// get directories
const getDirectories = source => readdirSync(source).map(name => join(source, name)).filter(isDirectory);
const web3Modules = getDirectories(`${__dirname}/node_modules/web3/packages`); // web3 node_modules
const nodeModules = [`${__dirname}/node_modules`];
nodeModules.push(...web3Modules.map(m => join(m, 'node_modules')));
// in webpack rules use
resolve: {
modulesDirectories: nodeModules,
]
By the way, for webpack to work, this request https://github.com/ethereum/web3.js/pull/1006 needs to get merged too.
thanks for your fast reply. I use npm and not yarn. It seems that my problem really has todo with webpack...
@stefanhuber Try adding extra module directories in webpack resolve as I mentioned above https://github.com/ethereum/web3.js/issues/966#issuecomment-324604175 and see if works?
@jdkanani thank you for your solution. However I have no idea where I should add this script. Could you a little bit more specific on that?
@stefanhuber Add that script (or javascript equivalent) into your webpack.config.js
. It just creates array with extra module paths to resolve imports for webpack.
nodeModules
will have something like this:
[
'/Users/stefanhuber/...yourprojectpath.../node_modules',
'/Users/stefanhuber/...yourprojectpath.../node_modules/web3/packages',
'/Users/stefanhuber/...yourprojectpath.../node_modules/web3/packages/web3-core/node_modules',
'/Users/stefanhuber/...yourprojectpath.../node_modules/web3/packages/web3-core-requestmanager/node_modules',
.....
.....
]
Now you assign that array to your webpack rules (in js/jsx loader) in webpack.config file.
@jdkanani ok I managed to organize this inside the webpack and it seems to work.
web3.version is 1.0.0-beta.18, however the object web3.eth.contract is undefined. is there a different api?
TypeError: window.web3.eth.contract is not a function
at http://localhost:8100/build/main.js:71:44
at t.invokeTask (http://localhost:8100/build/polyfills.js:3:9967)
at Object.onInvokeTask (http://localhost:8100/build/vendor.js:4499:37)
at t.invokeTask (http://localhost:8100/build/polyfills.js:3:9888)
at r.runTask (http://localhost:8100/build/polyfills.js:3:5143)
at invoke (http://localhost:8100/build/polyfills.js:3:10945)
at n (http://localhost:8100/build/polyfills.js:2:28549)
@stefanhuber web3.eth.Contract
I just added export NODE_PATH=path/yo/node modules and web3 gets loaded. THis is same as commented by @pcjose
Out of curiosity, why would beta software become the default download of NPM vs whatever the previous stable is?
Someone still has this issue? It still appears in the last version "web3": "^1.0.0-beta2"
This just started happening to me this morning trying to start truffle develop
.
Running web3 1.0.0-beta2
npm outdated
reports the latest as being 1.0.0-beta.26
Now I'm confused as to which is actually the most recent. Either way I tried installing 1.0.0-beta.26
instead and I get the same error. Running Truffle 4.0.1
@davesag I've downgraded to web3.js 0.20.2
Bottom line: web3 is in fucking shambles. There are a billion versions of every method across a bunch of "beta" releases, the "beta" is the default from the npm registry, and the documentation is fragmented.
Use anything else if you can
To fix:
Error: Cannot find module 'web3-requestManager'
Try installing specified, latest version. The problem seems to be that npm is confused what version is the latest and also not all dependencies work. When you run npm outdated
and it seems like this:
Package Current Wanted Latest Location
web3 1.0.0-beta2 1.0.0-beta2 1.0.0-beta.26
It may not work. Your current version should match the latest version, so use:
npm install web3@1.0.0-beta.26
Your npm outdated
will show you that you don't have the wanted version:
web3 1.0.0-beta.26 1.0.0-beta2 1.0.0-beta.26
But it works. I don't know why the people who package web3 didn't see there is clearly a problem. Maybe they know some workaround? It seems that node is stripping out the '6' at the end of the wanted version so if you run npm install web3
it install latest version of web3, but is considering it as '1.0.0-beta2' which does not resolve some dependencies.
Works for me, but I am not using truffle. Are you sure you are updating the web3 in the npm directory that truffle uses? Also, you may try uninstall web3 first and install specified version.
FYI, I had this problem. Here's what caused the problem.
My web3 submodules were then deleted.
To bring them back, I removed and then reinstalled web3.
This error still persists. As others have pointed out, NPM seems to be downloading web3@1.0.0-beta2
in place of web3@1.0.0-beta.2*
.
In my case I'm trying to distribute a package that uses web3@1.0.0-beta.28
to users over NPM. The package will download the wrong web3 version anytime someone tries to install my package. It is unfortunate, but I am forced to downgrade to the stable version for now until a workaround is found...
Same issue while trying to deploy a code that uses web3 to Firebase Functions. @frozeman, any updates?
Stuck with this. npm install web3
installs 0.2
version. It does not even support promises. Fix this please. Its painful to trace a callback is not defined
error from web3 till this thread to find out npm
is not fetching 1.0.x
version.
Any chance this may be resolved soon? I am also stuck having to use an ugly workaround 😅 .
Thanks!
Still appears to be happening…why is this closed? Tried everything in this thread with no luck.
The same thing after npm update
, web3 updates to web3@1.0.0-beta2 instead of current web3@1.0.0-beta30
However reinstalling helps:
npm r web3
npm i web3
Resolved the web3-requestManager issue by pinning to 1.0.0-beta.29 version. Previously it was installing 1.0.0-beta.2.
I came across a same problem after I did yarn upgrade
.
As @daniyalzade has mentioned above, "pinning" the version explicitly (without ^
or ~
) in package.json could be a workaround.
"dependencies": {
"web3": "1.0.0-beta.31"
}
Seems like the version 1.0.0-beta2
which not having a "dot" after beta is somehow confusing yarn to resolve the latest version.
I'm getting this in 1.0.0-beta.31, but it works with 1.0.0-beta.30
going back to 1.0.0-beta.30 didnt work for me, but removing ^ did
I had same issue but changing to fixed old version didn't help. Then I realized I am using very new version of Ganache that itself depended on new Web3.js version, thus overriding my package.json Web3js version.
I had the exact same problem. I needed to retrieve the Web3.js package directly from the develop branch on GitHub to fix the following error that was being thrown when I tried to run the Node.JS app:
module.js:549 throw err; ^
Error: Cannot find module 'web3-requestManager'
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.
This the command I used to do that. It took a fair amount of time to complete so for a while I thought the install had hung. It took almost 10 minutes to fully install:
npm install ethereum/web3.js#develop --save --verbose
After that I was able to run my Node.js app.
For deploying to firebase functions it seems they use yarn and removing the ^ allowed it to deploy successfully for me. Apparently yarn has trouble parsing this version syntax for nested dependencies.
@nickjuntilla thanks. It worked!
thanks vsdigitall my error cleared.. Error: Cannot find module 'web3-requestManager'
reinstalling helps:
I started getting this error after I ran npm update
, I had to get the original package.json that was in my remote github, remove the local node_modules and then run: npm install
I have seen this after npm audit fix
which downgraded my web3 to the deprecated 1.0.0-beta2. The fix was to return to the non-broken version.
npm install web3@1.0.0-beta.26, just go for it
Using node 6.11.1 on a macosx
I installed web3 with the following command:
Then i launch this - apparently - simple node command:
Well, it returns the following error:
it looks like it require some module (e.g. 'web3-requestManager') that aren't installed with the package.
Any Idea? Am i doing something wrong?