Terminal issue with New chainlink course

Thank you! Guess I would have need to watch 10 seconds more of the video :frowning: .

Now I am getting the following error if I would like to migrate ( I have created the .env file with the MNEMONIC and RPC_URL variable with it). I have googled it also and the suggestions I have found was to install npm install @truffle/hdwallet-provider, but it did not solve the issue. so this dotenv actually referencing to .env?

Thank you for the help as always @thecil

Error: Cannot find module 'dotenv'
Require stack:
- C:\Users\Riki\Desktop\Solidity\Chainlink\truffle-config.js
- C:\Users\Riki\AppData\Roaming\npm\node_modules\truffle\node_modules\original-require\index.js
- C:\Users\Riki\AppData\Roaming\npm\node_modules\truffle\build\cli.bundled.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:880:15)
    at Function.Module._load (internal/modules/cjs/loader.js:725:27)
    at Module.require (internal/modules/cjs/loader.js:952:19)
    at require (internal/modules/cjs/helpers.js:88:18)
    at Object.<anonymous> (C:\Users\Riki\Desktop\Solidity\Chainlink\truffle-config.js:2:1)
    at Module._compile (internal/modules/cjs/loader.js:1063:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
    at Module.load (internal/modules/cjs/loader.js:928:32)
    at Function.Module._load (internal/modules/cjs/loader.js:769:14)
    at Module.require (internal/modules/cjs/loader.js:952:19)
    at Object.require (internal/modules/cjs/helpers.js:88:18)
    at Function.load (C:\Users\Riki\AppData\Roaming\npm\node_modules\truffle\build\webpack:\packages\config\dist\index.js:160:1)
    at Function.detect (C:\Users\Riki\AppData\Roaming\npm\node_modules\truffle\build\webpack:\packages\config\dist\index.js:149:1)
    at Object.run (C:\Users\Riki\AppData\Roaming\npm\node_modules\truffle\build\webpack:\packages\core\lib\commands\develop.js:47:1)
    at Command.run (C:\Users\Riki\AppData\Roaming\npm\node_modules\truffle\build\webpack:\packages\core\lib\command.js:140:1)
    at Object.586806 (C:\Users\Riki\AppData\Roaming\npm\node_modules\truffle\build\webpack:\packages\core\cli.js:51:1)
    at __webpack_require__ (C:\Users\Riki\AppData\Roaming\npm\node_modules\truffle\build\webpack:\webpack\bootstrap:18:1)
    at __webpack_require__.x (C:\Users\Riki\AppData\Roaming\npm\node_modules\truffle\build\webpack:\webpack\bootstrap:36:1)
    at Function.__webpack_require__.x (C:\Users\Riki\AppData\Roaming\npm\node_modules\truffle\build\webpack:\webpack\runtime\startup chunk dependencies:35:1)
    at C:\Users\Riki\AppData\Roaming\npm\node_modules\truffle\build\webpack:\webpack\startup:3:1
    at Object.<anonymous> (C:\Users\Riki\AppData\Roaming\npm\node_modules\truffle\build\cli.bundled.js:633:12)
    at Module._compile (internal/modules/cjs/loader.js:1063:30)
Truffle v5.3.2 (core: 5.3.2)
Node v14.15.5
1 Like

indeed, you are missing the module dotenv

https://www.npmjs.com/package/dotenv

Are you sure that you have deployed your smartcontractkit/box? Cuz it should install all the dependecies once its deployed.

https://blog.chain.link/how-to-use-chainlink-with-truffle-2/

Carlos Z

Yes I am sure I did and also I have start everything from scratch again and rerun the whole video and did the same thing. I was able to go on now with the dotenv issue but now I am getting these when I would like to migrate (also I have done the npm install @truffle/hdwallet-provider ).

/C/Users/Judit/Desktop/Solidity - Truffle/Solidity/Chainlink/contracts/MyContract.sol:4:1: ParserError: Source "@chainlink/contracts/src/v0.6/ChainlinkClient.sol" not found: File import callback not supported
import "@chainlink/contracts/src/v0.6/ChainlinkClient.sol";
^---------------------------------------------------------^
,/C/Users/Judit/Desktop/Solidity - Truffle/Solidity/Chainlink/contracts/MyContract.sol:5:1: ParserError: Source "@openzeppelin/contracts/access/Ownable.sol" not found: File import callback not supported
import "@openzeppelin/contracts/access/Ownable.sol";
^--------------------------------------------------^
,/C/Users/Judit/Desktop/Solidity - Truffle/Solidity/Chainlink/contracts/PriceConsumerV3.sol:4:1: ParserError: Source "@chainlink/contracts/src/v0.6/interfaces/AggregatorV3Interface.sol" not found: File import callback not supported
import "@chainlink/contracts/src/v0.6/interfaces/AggregatorV3Interface.sol";
^--------------------------------------------------------------------------^
,/C/Users/Judit/Desktop/Solidity - Truffle/Solidity/Chainlink/contracts/RandomNumberConsumer.sol:4:1: ParserError: Source "@chainlink/contracts/src/v0.6/VRFConsumerBase.sol" not found: File import callback not supported
import "@chainlink/contracts/src/v0.6/VRFConsumerBase.sol";
^---------------------------------------------------------^
,/C/Users/Judit/Desktop/Solidity - Truffle/Solidity/Chainlink/contracts/test/MockV3Aggregator.sol:4:1: ParserError: Source "@chainlink/contracts/src/v0.6/tests/MockV3Aggregator.sol" not found: File import callback not supported
import "@chainlink/contracts/src/v0.6/tests/MockV3Aggregator.sol";
^----------------------------------------------------------------^
,/C/Users/Judit/Desktop/Solidity - Truffle/Solidity/Chainlink/contracts/test/VRFCoordinatorMock.sol:4:1: ParserError: Source "@chainlink/contracts/src/v0.6/tests/VRFCoordinatorMock.sol" not found: File import callback not supported
import "@chainlink/contracts/src/v0.6/tests/VRFCoordinatorMock.sol";
^------------------------------------------------------------------^

I am pretty sure I have done the boxing command. But if I look in these files. So as far as I understand what is going on here is that these upper files are missing. If I for example check the openzeppelin one it’s nowhere to be found after I have done the unboxing. I also did the yarn command, do not think that has any connection with it but it said the following at the end: error Couldn’t find the binary git.

1 Like

Please verify that you have installed properly the chainlink contracts which should be in your node_moduels folder.

image

Carlos Z

I will do a step by step part what I am doing.

So first step is to add the unboxing part:

picture 1

after that I am adding in yarn.

picture 2

I think this is where the issue lies because for the instructor he is having the node_modules part in now on this folder but I still don’t.

picture 3

1 Like

Try with:

npm install

It should star downloading all the dependencies from the smart contract kit.

Carlos Z

Pls I don’t get while my Terminal keep saying that file import callback not supported…what can I do?

Please share an screenshot of what the console is showing you :nerd_face:

Carlos Z

Hi Im having an issue on the Truffle section in the course. I’ve set up my .env , I run into this error whe i

truffle migrate --network kovan --reset

Error: Unknown arguments format passed to new HDWalletProvider. Please check your configuration and try again
    at Object.getOptions (C:\Users\jflor\MyChainLinkProject\node_modules\@truffle\hdwallet-provider\src\constructor\getOptions.ts:143:11)
    at new HDWalletProvider (C:\Users\jflor\MyChainLinkProject\node_modules\@truffle\hdwallet-provider\src\index.ts:68:9)
    at Object.provider (C:\Users\jflor\MyChainLinkProject\truffle-config.js:28:16)
    at Object.getProvider (C:\Users\jflor\AppData\Roaming\npm\node_modules\truffle\build\webpack:\packages\provider\index.js:20:1)
    at Object.create (C:\Users\jflor\AppData\Roaming\npm\node_modules\truffle\build\webpack:\packages\provider\index.js:13:1)
    at TruffleConfig.get [as provider] (C:\Users\jflor\AppData\Roaming\npm\node_modules\truffle\build\webpack:\packages\config\dist\configDefaults.js:207:1)
    at Object.detect (C:\Users\jflor\AppData\Roaming\npm\node_modules\truffle\build\webpack:\packages\environment\environment.js:19:1)
    at Object.run (C:\Users\jflor\AppData\Roaming\npm\node_modules\truffle\build\webpack:\packages\core\lib\commands\migrate.js:201:1)
    at Command.run (C:\Users\jflor\AppData\Roaming\npm\node_modules\truffle\build\webpack:\packages\core\lib\command.js:183:1)
Truffle v5.4.16 (core: 5.4.16)
Node v14.16.0
const HDWalletProvider = require('@truffle/hdwallet-provider')
require('dotenv').config()

const mnemonic = process.env.MNEMONIC
const url = process.env.RPC_URL

module.exports = {
  networks: {
    cldev: {
      host: '127.0.0.1',
      port: 8545,
      network_id: '*',
    },
    ganache: {
      host: '127.0.0.1',
      port: 7545,
      network_id: '*',
    },
    binance_testnet: {
      provider: () => new HDWalletProvider(mnemonic,'https://data-seed-prebsc-1-s1.binance.org:8545'),
      network_id: 97,
      confirmations: 10,
      timeoutBlocks: 200,
      skipDryRun: true
    },
    kovan: {
      provider: () => {
        return new HDWalletProvider(mnemonic, url)
      },
      network_id: '42',
      skipDryRun: true
    },
  },
  compilers: {
    solc: {
      version: '0.6.6',
    },
  },
}

Hi Carlos, hope all is well. Im having an issue in chainlink101 , if you can take look at the post above. Thanks.

Hey @Javier_Flores, hope you are good.

I see you are using a higher version of nodejs, “14.16.0”.

Try to follow this guide to downgrade it to version “10” or “12” (im using v12.0.0 it does work good).

Let me know how it goes :nerd_face:

Carlos Z

Hi @thecil Carlos, I downgraded to version10, but it gave me the same error. I’m trying to find the 12 version on the page link, but it only seems to have the 10. I also check the node.js org but only have the 16 version. Do you know where I can get version 12 to try that?

The error is stating that there’s an argument format passed through issue with new HDWalletProvider, maybe a configuration problem? Also Im I suppose to be running a ganche chain along with truffle/chainLink as well?

Hi Carlos, yea I tried what you suggested, but no luck, I notice in other posts similar its a migration issue?

I could find the 12 version on link. Also am I suppose to use ganache and configure it too with metamask mnemonic?

You should run just 1, or truffle develop which create a local blockchain, just like ganache, in fact maybe would be better to try with truffle, i know that ganache some times goes buggy.

Carlos Z

Hi Carlos, yea truffle develop does the same thing, there was also an issue when compiling , maybe thats the cause?

> Compiling .\contracts\test\MockV3Aggregator.sol
> Compiling .\contracts\test\VRFCoordinatorMock.sol
> Compilation warnings encountered:

    @chainlink/contracts/src/v0.6/tests/VRFCoordinatorMock.sol:17:46: Warning: Unused function parameter. Remove or comment out the variable name to silence this warning.
    function onTokenTransfer(address sender, uint256 fee, bytes memory _data)
                                             ^---------^
,@chainlink/contracts/src/v0.6/tests/VRFCoordinatorMock.sol:34:10: Warning: Unused local variable.
        (bool success,) = consumerContract.call(resp);
         ^----------^

> Artifacts written to C:\Users\jflor\MyChainLinkProject\build\contracts
> Compiled successfully using:
   - solc: 0.6.6+commit.6c089d02.Emscripten.clang

Error: Unknown arguments format passed to new HDWalletProvider. Please check your configuration and try again

HI @thecil Carlos , hope your good, Im still having this HDWalletProvider issue, I cant get the contracts to migrate, ive check the truffle config file its seem in order, so Im stuck from continuing course, If you can help or maybe dani or gabba?

Ive tried https://www.npmjs.com/package/@truffle/hdwallet-provider

but no luck. Thanks

Javier

Maybe you are not typing the proper parameters on your .env file, i will show you mine as an example, i delete most of it, but just to give you an example. Also my dependecies, in case your are missing one, the warning messages are not an issue, will not stop the deployment.

Also, are you deploying on kovan right? Its the only network where the chainlink contract exist for this course.

I deployed a fresh lottery contract, just to discard an issue with one of the dependencies:
https://kovan.etherscan.io/tx/0xabf514c171380d5d3f8e2f0a03f1ec59e4b2031d3e577fe510421d8232150b77

Carlos Z

@thecil Hi Carlos, yes it will not let me continue to deploy, Yes im on Kovan, using metamask wallet seed, test eth and LINK.

const HDWalletProvider = require('@truffle/hdwallet-provider')
require('dotenv').config()

const mnemonic = process.env.MNEMONIC
const url = process.env.RPC_URL

module.exports = {
  networks: {
    cldev: {
      host: '127.0.0.1',
      port: 8545,
      network_id: '*',
    },
    ganache: {
      host: '127.0.0.1',
      port: 7545,
      network_id: '*',
    },
    binance_testnet: {
      provider: () => new HDWalletProvider(mnemonic,'https://data-seed-prebsc-1-s1.binance.org:8545'),
      network_id: 97,
      confirmations: 10,
      timeoutBlocks: 200,
      skipDryRun: true
    },
    kovan: {
      provider: () => {
        return new HDWalletProvider({ mnemonic: mnemonic, providerOrUrl:url, chainId:42})
      },
      network_id: '42',
      skipDryRun: true
    },
  
  },
  compilers: {
    solc: {
      version: '0.6.6',
    },
  },
}

I think it can be a bad syntax here, you dont need to send those arguments as an object {}, instead just send it normally as 2 arguments.

This is mine:

    kovan: {
      provider: () => {
        return new HDWalletProvider(mnemonic, url)
      },
      network_id: '42',
      skipDryRun: true
    },

try that one in your truffle config, also if still not working, maybe it could be because you are using a seed phrase instead the hexadecimal private key (thats why your is a string of characters, while mine is a bunch of numbers and letters), the difference is that your seed contain 20 accounts with their own priv key (in hexa, like mine), so im just sending it the priv key of 1 of my 20 accounts.

Let me know how your going :nerd_face:

Carlos Z

Hi @thecil Carlos, I changed the to correct kovan config, and also to hex mnemonic, still getting Argument error

Error: Unknown arguments format passed to new HDWalletProvider. Please check your configuration and try again
    at Object.getOptions (C:\Users\jflor\MyChainLinkProject\node_modules\@truffle\hdwallet-provider\src\constructor\getOptions.ts:143:11)
    at new HDWalletProvider (C:\Users\jflor\MyChainLinkProject\node_modules\@truffle\hdwallet-provider\src\index.ts:68:9)
    at Object.provider (C:\Users\jflor\MyChainLinkProject\truffle-config.js:28:16)
    at Object.getProvider (C:\Users\jflor\AppData\Roaming\npm\node_modules\truffle\build\webpack:\packages\provider\index.js:20:1)
    at Object.create (C:\Users\jflor\AppData\Roaming\npm\node_modules\truffle\build\webpack:\packages\provider\index.js:13:1)
    at TruffleConfig.get [as provider] (C:\Users\jflor\AppData\Roaming\npm\node_modules\truffle\build\webpack:\packages\config\dist\configDefaults.js:235:1)
    at Object.detect (C:\Users\jflor\AppData\Roaming\npm\node_modules\truffle\build\webpack:\packages\environment\environment.js:19:1)
    at Object.run (C:\Users\jflor\AppData\Roaming\npm\node_modules\truffle\build\webpack:\packages\core\lib\commands\migrate.js:201:1)
    at Command.run (C:\Users\jflor\AppData\Roaming\npm\node_modules\truffle\build\webpack:\packages\core\lib\command.js:183:1)

    kovan: {
      provider: () => {
        return new HDWalletProvider(mnemonic, url)
      },
      network_id: '42',
      skipDryRun: true
    },
  
  },
  compilers: {
    solc: {
      version: '0.6.6',
    },
  },
}

MNEMONIC="1c49d2330c06ba699edb3ecc24a4f674db2f1b....."
RPC_URL="https://kovan.infura.io/v3/7d82a16ccf554b9a9...../"