“路径”参数必须是字符串类型。收到未定义。未能验证 1 份合同
Posted
技术标签:
【中文标题】“路径”参数必须是字符串类型。收到未定义。未能验证 1 份合同【英文标题】:The "path" argument must be of type string. Received undefined. Failed to verify 1 contract(s) 【发布时间】:2021-10-03 20:20:04 【问题描述】:我正在将智能合约部署到 rinkeby 网络,然后尝试验证合约
truffle run verify IzoneMember --network rinkeby
但它不起作用并一直显示此消息,但是我已经安装了 truffle-verify-plugin、react-script 和 cucumber。
PS C:\Users\dohva\Documents\Github Repo\NFT\truffle-starter-kit> truffle run verify IzoneMember --network rinkeby
Verifying IzoneMember
The "path" argument must be of type string. Received undefined
Failed to verify 1 contract(s): IzoneMember
这是我的 package.json
"name": "@chainlink/box",
"version": "0.6.0",
"description": "A Chainlink example in a Truffle box",
"scripts":
"compile": "npx truffle compile",
"console:dev": "npx truffle console --network cldev",
"console:kovan": "npx truffle console --network kovan",
"depcheck": "echo '@chainlink/box' && depcheck --ignore-dirs=build/contracts || true",
"solhint": "solhint ./contracts/**/*.sol",
"lint": "yarn solhint",
"migrate:dev": "npx truffle migrate --reset --network cldev",
"migrate:kovan": "npx truffle migrate --network kovan",
"test": "npx truffle test"
,
"license": "MIT",
"dependencies":
"@chainlink/contracts": "^0.1.9",
"@cucumber/cucumber": "^7.3.1",
"@openzeppelin/contracts": "^3.4.1",
"@truffle/hdwallet-provider": "^1.4.2",
"bip39": "^3.0.4",
"cucumber": "^7.0.0-rc.0",
"dotenv": "^8.6.0",
"react-scripts": "^4.0.3",
"web3": "^1.4.0"
,
"devDependencies":
"@chainlink/belt": "^0.0.3",
"@chainlink/test-helpers": "0.0.5",
"@openzeppelin/test-helpers": "^0.5.10",
"chai": "^4.3.0",
"depcheck": "^1.3.1",
"solhint": "^3.3.2",
"truffle": "^5.3.1",
"truffle-plugin-verify": "^0.5.11"
,
"resolutions":
"**/minimist": "^0.2.1",
"**/node-fetch": "^2.6.1",
"**/yargs-parser": "^13.1.2",
"**/mem": "^4.0.0"
,
"react-scripts": "^4.0.3"
这是我的 truffle-config.js
const HDWalletProvider = require('@truffle/hdwallet-provider')
require('dotenv').config()
const mnemonic = process.env.MNEMONIC
const url = process.env.RINKEBY_RPC_URL
module.exports =
networks:
rinkeby:
provider: () =>
new HDWalletProvider(
mnemonic: process.env.MNEMONIC,
providerOrUrl: "https://rinkeby.infura.io/v3/dd2fabf723e1433ba4a9339cae33afa6",
numberOfAddresses: 1,
shareNonce: true,
),
network_id: '4',
,
development:
host: 'localhost',
port: 7545,
network_id: '*', // Match any network id
,
mainnet:
provider: () =>
return new HDWalletProvider(process.env.MAINNET_MNEMONIC, process.env.MAINNET_RPC_URL)
,
network_id: '1',
skipDryRun: true,
,
,
compilers:
solc:
version: "^0.6.6",
,
api_keys:
etherscan: "52NGDWZMANK51AXZ6ST3Z9PQS97WZP8X15"
,
plugins: [
'truffle-plugin-verify'
]
【问题讨论】:
这能回答你的问题吗? TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received type undefined raised when starting react app 感谢您提供的信息,但 react 应用在我身上运行良好 您找到解决此问题的方法了吗? 是的,我有,HDWalletProvider 的代码结构是错误的,但它适用于我观看的 youtube 视频 【参考方案1】:对我来说,我有我的导入合同,例如,
../node_modules/@openzeppelin
我删除了../node_modules/
并修复了
【讨论】:
以上是关于“路径”参数必须是字符串类型。收到未定义。未能验证 1 份合同的主要内容,如果未能解决你的问题,请参考以下文章
错误:“路径”参数必须是字符串类型。唱歌apk github动作时收到类型未定义
npm 发布失败,并显示““路径”参数必须是字符串类型。收到未定义”
NodeJS - TypeError [ERR_INVALID_ARG_TYPE]:“路径”参数必须是字符串类型。收到未定义
Nrwl:Storybook 给我错误 TypeError [ERR_INVALID_ARG_TYPE]:“路径”参数必须是字符串类型。收到未定义