简体   繁体   English

无法将 Solidity 合约部署到 Rinkeby.network(无效的 asm.js:stdlib 的无效成员)

[英]Unable to deploy Solidity contract to Rinkeby network (Invalid asm.js: Invalid member of stdlib)

I've been learning Solidity using this course by Stephen Grider and it's been going well until now, where I am trying to deploy my code to the Rinkeby test.network.我一直在使用 Stephen Grider 的这门课程学习 Solidity,直到现在它一直进展顺利,我正在尝试将我的代码部署到 Rinkeby test.network。

For reference, I am using Node version 11.15.0 with npm version 6.7.0 with these dependencies:作为参考,我使用的节点版本 11.15.0 和 npm 版本 6.7.0 具有以下依赖项:

"dependencies": {
    "ganache-cli": "^6.4.3",
    "mocha": "^6.1.4",
    "nan": "^2.14.0",
    "scrypt": "^6.0.3",
    "solc": "^0.4.25",
    "truffle": "^4.1.15",
    "truffle-hdwallet-provider": "0.0.4",
    "web3": "^1.0.0-beta.35" }

I have spent hours switching between versions of Node.js, npm, and all sorts of combinations of the dependencies, from the most current versions to the versions specified in the course.我花了几个小时在 Node.js、npm 的版本以及依赖项的各种组合之间切换,从最新版本到课程中指定的版本。 While I am getting a multitude of issues, the most prominent two seem to be虽然我遇到了很多问题,但最突出的两个似乎是

(node:32436) V8: C:\Desktop\solidity\inbox\node_modules\solc\soljson.js:3 Invalid asm.js: Invalid member of stdlib

and

C:\Desktop\solidity\inbox\node_modules\solc\soljson.js:1
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=typeof window==="object";var ENVIRONMENT_IS_WORKER=typeof importScripts==="function";var ENVIRONMENT_IS_NODE=typeof process==="object"&&typeof require==="function"&&!ENVIRONMENT_IS_WEB&&!ENVIRONMENT_IS_WORKER;var ENVIRONMENT_IS_SHELL=!ENVIRONMENT_IS_WEB&&!ENVIRONMENT_IS_NODE&&!ENVIRONMENT_IS_WORKER;if(ENVIRONMENT_IS_NODE){if(!Module["print"])Module["print"]=function print(x){process["stdout"].write(x+"\n")};if(!Module["printErr"])Module["printErr"]=function printErr(x){process["stderr"].write(x+"\n")};var nodeFS=require("fs");var nodePath=require("path");Module["read"]=function read(filename,binary){filename=nodePath["normalize"](filename);var ret=nodeFS["readFileSync"](filename);if(!ret&&filename!=nodePath["resolve"](filename)){filename=path.joi

Error: CONNECTION ERROR: Couldn't connect to node rinkeby.infura.io/v3/acb10732334e4450ba7dc55e618eb70a.
    at Object.InvalidConnection (C:\Desktop\solidity\inbox\node_modules\truffle-hdwallet-provider\node_modules\web3\lib\web3\errors.js:28:16)
    at HttpProvider.sendAsync (C:\Desktop\solidity\inbox\node_modules\truffle-hdwallet-provider\node_modules\web3\lib\web3\httpprovider.js:129:25)
    at Web3Subprovider.handleRequest (C:\Desktop\solidity\inbox\node_modules\web3-provider-engine\subproviders\web3.js:13:17)
    at next (C:\Desktop\solidity\inbox\node_modules\web3-provider-engine\index.js:95:18)
    at FilterSubprovider.handleRequest (C:\Desktop\solidity\inbox\node_modules\web3-provider-engine\subproviders\filters.js:87:7)
    at next (C:\Desktop\solidity\inbox\node_modules\web3-provider-engine\index.js:95:18)
    at HookedWalletSubprovider.handleRequest (C:\Desktop\solidity\inbox\node_modules\web3-provider-engine\subproviders\hooked-wallet.js:109:7)
    at next (C:\Desktop\solidity\inbox\node_modules\web3-provider-engine\index.js:95:18)
    at Web3ProviderEngine._handleAsync (C:\Desktop\solidity\inbox\node_modules\web3-provider-engine\index.js:82:3)
    at Web3ProviderEngine._fetchBlock (C:\Desktop\solidity\inbox\node_modules\web3-provider-engine\index.js:191:8)
    at Web3ProviderEngine._fetchLatestBlock (C:\Desktop\solidity\inbox\node_modules\web3-provider-engine\index.js:167:8)
    at Web3ProviderEngine._startPolling (C:\Desktop\solidity\inbox\node_modules\web3-provider-engine\index.js:144:8)
    at Web3ProviderEngine.start (C:\Desktop\solidity\inbox\node_modules\web3-provider-engine\index.js:38:8)
    at new HDWalletProvider (C:\Desktop\solidity\inbox\node_modules\truffle-hdwallet-provider\index.js:46:15)
    at Object.<anonymous> (C:\Desktop\solidity\inbox\deploy.js:6:18)
    at Module._compile (internal/modules/cjs/loader.js:816:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:827:10)
    at Module.load (internal/modules/cjs/loader.js:685:32)
    at Function.Module._load (internal/modules/cjs/loader.js:620:12)
    at Function.Module.runMain (internal/modules/cjs/loader.js:877:12)
    at internal/main/run_main_module.js:21:11

My question would be are there any fixes for either of these issues based on my code, or is there a simpler way to deploy to the blockchain?我的问题是,是否有任何基于我的代码的这些问题的修复,或者是否有更简单的方法来部署到区块链? Thank you in advance.先感谢您。

Error: CONNECTION ERROR: Couldn't connect to node rinkeby.infura.io/v3/acb10732334e4450ba7dc55e618eb70a.

您可能是指https://rinkeby.infura.io/... (您错过了https:// 。)

I am following the same tutorial as the OP.我正在遵循与 OP 相同的教程。 If you are using node v14.15.4 and npm v6.14.10, I would like to confirm that the following package.json solved the issue:如果您使用的是node v14.15.4 和npm v6.14.10,我想确认以下package.json解决了这个问题:

{
  "name": "inbox",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "mocha"
  },
  "author": "",
  "license": "ISC",
  "dependencies": {
    "ganache-cli": "^6.4.3",
    "mocha": "^6.1.4",
    "solc": "^0.4.25",
    "truffle-hdwallet-provider": "0.0.4",
    "web3": "^1.0.0-beta.35"
  }
}

Then rebuild your dependencies by deleting your node_modules of your project, then run然后通过删除项目的node_modules重建依赖项,然后运行

npm install

There may be a problem with the version of the relevant library file, please run the following command.可能是相关库文件版本有问题,请运行以下命令。

npm install solc

My npm version is 7.20.3我的npm版本是7.20.3

In my case, the problem was that in the https://infura.io site dropdown what I selected was MAI.NET instead of RINKEBY which is an ethereum test.network.就我而言,问题是在https://infura.io站点下拉列表中,我选择的是 MAI.NET 而不是 RINKEBY,它是一个以太坊测试网络。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM