Comments (10)
@james-stevens and anyone who is having this issues
From Web3.js 4.x
You should do this
const { Web3 } = require('web3');
Instead of doing this
const Web3 = require('web3');
from ethereum-bridge.
#! /usr/bin/node
const myWeb3 = require("web3");
const web3 = new myWeb3("https://eth-mainnet.g.alchemy.com/v2/**************************");
web3.eth.ens.getContenthash("james.eth").then((result) => { console.log(result); });
gets....
const web3 = new myWeb3("https://eth-mainnet.g.alchemy.com/v2/I1iLOFKvcQ5NEt7GnYfmQDwXpYipWPaw");
^
TypeError: myWeb3 is not a constructor
at Object.<anonymous> (/root/python/web3/web3.js:4:14)
at Module._compile (node:internal/modules/cjs/loader:1254:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1308:10)
at Module.load (node:internal/modules/cjs/loader:1117:32)
at Module._load (node:internal/modules/cjs/loader:958:12)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
at node:internal/main/run_main_module:23:47
worked fine until I upgraded node from v16 to v18
Tried updating web3
, tried removing it & reinstalling it - no luck
from ethereum-bridge.
thanks @Oguntoye, I went with converting to module syntax
import { Web3 } from 'web3';
const web3 = new Web3("https://eth-mainnet.g.alchemy.com/v2/*****************");
I was just disappointed that code that had worked in node v16 then failed just by upgrading to node v18 - and ALL the tutorials I found online used to older syntax, that now doesn't work.
Getting anything working in web3 is hard enough - to then have it killed by an update was a killer.
from ethereum-bridge.
Hi @R-a-x , have you run npm install
before?
from ethereum-bridge.
@marcogiglio its hard to say, is there any way I can confirm that
from ethereum-bridge.
Probably not if you have this error. Just try to run it and see if it works?
from ethereum-bridge.
If you have executed npm install then a folder called "node_modules" should get created in your ethereum bridge extracted folder.
from ethereum-bridge.
I ran into the same issue,solved it by deleting package-lock.json, node_modules and doing npm install again. See if it works for you
from ethereum-bridge.
stale issue
from ethereum-bridge.
getting same error! anyone resolved it?
from ethereum-bridge.
Related Issues (20)
- HTTP query create request error
- Ethereum bridge stops writing into tingodb after sometime HOT 21
- What is the behaviour of --dev? HOT 1
- Remove unused dependencies HOT 1
- oraclize examples not firing first free query HOT 1
- Why the callback in my private ethereum chain don't work? HOT 3
- oraclize report "exceeds block gas limit" HOT 2
- Possibility to force query execution before specified delay HOT 2
- Cannot read property 'node' of undefined HOT 5
- Cannot debug callback transaction in truffle HOT 1
- Error: Key not found in database HOT 11
- Error: More than one instance of bitcore-lib found. HOT 3
- Oracle does not receive the queries HOT 10
- gas errors when using bridge with private geth network HOT 19
- Alternative Private Chains HOT 6
- I can't use Ethereum-Bridge HOT 1
- The bridge returns a response only one time
- Wrong information message in ethereum-bridge on ubuntu HOT 1
- pls how can i link this function in my smart contract to the function in my web page HOT 1
- ERROR http query create request error HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ethereum-bridge.