i am trying to compile my smart contract using truffle but i get this error msg :
Error: error:0308010C:digital envelope routines::unsupported
at new Hash (node:internal/crypto/hash:67:19)
at Object.createHash (node:crypto:130:10)
at hash160 (/usr/local/lib/node_modules/truffle/build/webpack:/node_modules/ethereum-cryptography/vendor/hdkey-without-crypto.js:249:1)
at HDKey.set (/usr/local/lib/node_modules/truffle/build/webpack:/node_modules/ethereum-cryptography/vendor/hdkey-without-crypto.js:50:1)
at Function.HDKey.fromMasterSeed (/usr/local/lib/node_modules/truffle/build/webpack:/node_modules/ethereum-cryptography/vendor/hdkey-without-crypto.js:194:1)
at Function.fromMasterSeed (/usr/local/lib/node_modules/truffle/build/webpack:/node_modules/ethereumjs-wallet/dist/hdkey.js:19:1)
at Object.getAccountsInfo (/usr/local/lib/node_modules/truffle/build/webpack:/packages/core/lib/mnemonics/mnemonic.js:48:1)
at Object.module.exports [as run] (/usr/local/lib/node_modules/truffle/build/webpack:/packages/core/lib/commands/develop/run.js:39:1)
at runCommand (/usr/local/lib/node_modules/truffle/build/webpack:/packages/core/lib/command-utils.js:201:1)
Truffle v5.5.28 (core: 5.5.28)
Node v16.15.0
what is the issue ? how can i solve it ? hints: i've reinstall nodejs in my laptop but without result .
Related
When running tests, I'm getting the following error:
1 Unhandled promise rejection:
Error: Cannot pipe, not readable
at new NodeError (node:internal/errors:387:5)
at ServerResponse.pipe (node:_http_outgoing:1070:22)
at respondOnWebSocket (D:\e2e\0.0.157\node_modules\testcafe\node_modules\testcafe-hammerhead\lib\request-pipeline\websocket.js:56:9)
at Array.decideOnProcessingStrategy (D:\e2e\0.0.157\node_modules\testcafe\node_modules\testcafe-hammerhead\lib\request-pipeline\stages.js:77:48)
at run (D:\e2e\0.0.157\node_modules\testcafe\node_modules\testcafe-hammerhead\lib\request-pipeline\index.js:20:34)
at processTicksAndRejections (node:internal/process/task_queues:95:5)
Does anyone have a suggestion on how to resolve this?
See future updates related to this issue in this GitHub thread.
Here is my problem,
I think I made mistake by adding proxy settings in a wrong way,
now every command begin with npm does not work.
here is a pic of the error:
λ npm config set registry "http://registry.npmjs.org/"
Error: Failed parsing JSON config key "proxy: "="'http://xxx.xx.xx.xx:8080'"
at parseField (E:\nodejs\node_modules\npm\lib\config\core.js:376:13)
at E:\nodejs\node_modules\npm\lib\config\core.js:330:24
at Array.forEach (<anonymous>)
at Conf.add (E:\nodejs\node_modules\npm\lib\config\core.js:328:23)
at ConfigChain.addString (E:\nodejs\node_modules\npm\node_modules\config-chain\index.js:244:8)
at Conf.<anonymous> (E:\nodejs\node_modules\npm\lib\config\core.js:316:10)
at E:\nodejs\node_modules\npm\node_modules\graceful-fs\graceful-fs.js:123:16
at FSReqCallback.readFileAfterClose [as oncomplete] (internal/fs/read_file_context.js:63:3)
Error: Failed parsing JSON config key "proxy: "="'http://xxx.xx.xx.xx:8080'"
at parseField (E:\nodejs\node_modules\npm\lib\config\core.js:376:13)
at E:\nodejs\node_modules\npm\lib\config\core.js:330:24
at Array.forEach (<anonymous>)
at Conf.add (E:\nodejs\node_modules\npm\lib\config\core.js:328:23)
at ConfigChain.addString (E:\nodejs\node_modules\npm\node_modules\config-chain\index.js:244:8)
at Conf.<anonymous> (E:\nodejs\node_modules\npm\lib\config\core.js:316:10)
at E:\nodejs\node_modules\npm\node_modules\graceful-fs\graceful-fs.js:123:16
at FSReqCallback.readFileAfterClose [as oncomplete] (internal/fs/read_file_context.js:63:3)
Assuming you set your proxy setting in a similar way to the registry setting you show: Delete the proxy line in your .npmrc file and try again. The .npmrc file can be found in the four places listed in the npm docs. In most cases, you'll find the one with the proxy entry in ~/.npmrc.
I have a Truffle example app and then when I try to interact with it in truffle console, I don't understand why it is not deploying or working.
I activate testrpc and then after that, I type:
> truffle console
> migrate --reset
> MetaCoin.new();
After that:
truffle(development)> MetaCoin.name
'TruffleContract'
truffle(development)> MetaCoin.country
undefined
truffle(development)> a1 = web3.eth.accounts[0];
'0x0a3d66a80b50875770fd264dd7c905f21395037f'
truffle(development)> MetaCoin.sendCoin(a1, 100);
TypeError: MetaCoin.sendCoin is not a function
at evalmachine.<anonymous>:1:10
at ContextifyScript.Script.runInContext (vm.js:59:29)
at Object.runInContext (vm.js:120:6)
at Console.interpret (/usr/local/lib/node_modules/truffle/build/cli.bundled.js:199314:17)
at ReplManager.interpret (/usr/local/lib/node_modules/truffle/build/cli.bundled.js:200019:18)
at bound (domain.js:301:14)
at REPLServer.runBound [as eval] (domain.js:314:12)
at REPLServer.onLine (repl.js:440:10)
at emitOne (events.js:115:13)
at REPLServer.emit (events.js:210:7)
truffle(development)> MetaCoin.sendCoin(a1, 100);
It says that the sendCoin function is not a function, so I'm not sure how to interact with the contract. How can I call that?
First deploy the contract using truffle migrate.
Then interact with the contract in the following way from truffle console
MetaCoin.deployed().then(function(instance) {return instance.sendCoin(a1, 100);}).then(function(value) {console.log(value);});
Looks like you want to access to contract with web3. This is how u interact with web3. since truffle is using web3 internally, u can use web3 inside truffle console. Inside the directory of the truffle config
$ truffle console
then
const instance=new web3.eth.Contract(Metacoin.abi,"addressOfDeployedContract")
const name=await instance.methods.name.call()
jspm init results in:
Package.json file does not exist, create it? [yes]:
err Error: EINVAL, invalid argument
at new Socket (net.js:157:18)
at process.stdin (node.js:687:19)
at MY_FOLDER\aurelia\aurelia-typescript-simple\node_modules\jspm\lib\ui.js:202:12
at lib$rsvp$$internal$$initializePromise (MY_FOLDER\aurelia\aurelia-typescript-simple\node_modules\jspm\node_modules\rsvp\dist\rsvp.js:1084:9)
at new lib$rsvp$promise$$Promise (MY_FOLDER\aurelia\aurelia-typescript-simple\node_modules\jspm\node_modules\rsvp\dist\rsvp.js:546:53)
at Object.exports.input (MY_FOLDER\aurelia\aurelia-typescript-simple\node_modules\jspm\lib\ui.js:190:10)
at Object.exports.confirm (MY_FOLDER\aurelia\aurelia-typescript-simple\node_modules\jspm\lib\ui.js:157:15)
at Promise.resolve.then.then.config.pjsonPath (MY_FOLDER\aurelia\aurelia-typescript-simple\node_modules\jspm\lib\config.js:70:17)
at tryCatchReject (MY_FOLDER\aurelia\aurelia-typescript-simple\node_modules\jspm\node_modules\systemjs\node_modules\when\es6-shim\Promise.js:1183:30)
at runContinuation1 (MY_FOLDER\aurelia\aurelia-typescript-simple\node_modules\jspm\node_modules\systemjs\node_modules\when\es6-shim\Promise.js:1142:4)
at Fulfilled.when (MY_FOLDER\aurelia\aurelia-typescript-simple\node_modules\jspm\node_modules\systemjs\node_modules\when\es6-shim\Promise.js:930:4)
at ContinuationTask.run (MY_FOLDER\aurelia\aurelia-typescript-simple\node_modules\jspm\node_modules\systemjs\node_modules\when\es6-shim\Promise.js:1040:24)
at Scheduler._drain (MY_FOLDER\aurelia\aurelia-typescript-simple\node_modules\jspm\node_modules\systemjs\node_modules\when\es6-shim\Promise.js:97:19)
at Scheduler.drain (MY_FOLDER\aurelia\aurelia-typescript-simple\node_modules\jspm\node_modules\systemjs\node_modules\when\es6-shim\Promise.js:62:9)
at process._tickCallback (node.js:442:13)
at Function.Module.runMain (module.js:499:11)
Could be related to this: https://github.com/jspm/jspm-cli/issues/610
Looks like this issue could be related to my cygwin installation: Node.js Cygwin not supported
Maybe it cannot enter the interactive prompt.
Using jspm init -y worked but it is not mentioned in most tutorials.
When I run node server.js in terminal, I receive the following error from mongoose:
/Users/XXXX/Desktop/Projects/crud/node_modules/mongoose/node_modules/mongodb/lib/server.js:235
process.nextTick(function() { throw err; })
^
Error: connect ECONNREFUSED 127.0.0.1:27017
at Object.exports._errnoException (util.js:860:11)
at exports._exceptionWithHostPort (util.js:883:20)
at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1063:14)
I've ran npm install mongoose with a warning, but I doubt that's the reason the mongodb database isn't running. Here is the warning:
> kerberos#0.0.17 install /Users/Sean/Desktop/Projects/crud/node_modules/kerberos
> (node-gyp rebuild) || (exit 0)
CXX(target) Release/obj.target/kerberos/lib/kerberos.o
CXX(target) Release/obj.target/kerberos/lib/worker.o
CC(target) Release/obj.target/kerberos/lib/kerberosgss.o
../lib/kerberosgss.c:509:13: warning: implicit declaration of function 'gss_acquire_cred_impersonate_name' is invalid in C99
[-Wimplicit-function-declaration]
maj_stat = gss_acquire_cred_impersonate_name(&min_stat,
^
1 warning generated.
CC(target) Release/obj.target/kerberos/lib/base64.o
CXX(target) Release/obj.target/kerberos/lib/kerberos_context.o
SOLINK_MODULE(target) Release/kerberos.node
It can happen when the mongodb service is not running on your machine.So start with below command it will be help you to open node server with no interrupt as well as mongodb will also run on default port.
brew services start mongodb