Cannot find module '@chainlink/contracts/truffle/v0.4/LinkToken'

I was following these steps in order to use Chainlink on Kovan testnet. when I’ve finished the configuration ( truffle-config.js , npm install to get all the dependencies, etc.) and I’ve compiled the contracts and all is working. But when I was doing:

truffle migrate --network kovan

I got an error about it couldn’t find the module @chainlink/contracts/truffle/v0.4/LinkToken . I’ve tried to find a solution on Internet but I didn’t find anything. Any help is more than welcome!


Hey @Joncarre, hope you are well.

Are you sure that you follow the proper steps from the instructions?

Cuz apparently you did not install the module properly, because its missing the LinkToken contract which should be on the node_modules folder and following the path referred on the require.

Carlos Z

hey @thecil , thanks a lot! I found a solution (I changed the path because I didn’t realise that I had those files in my node_modules folder) but then… I got another error.


¿Unexpected identifier? I also tried to change that line to v6.0, but there’s no LinkToken.sol file in v6.0 folder (that file only exists in v4.0). So that didn’t work either.

I don’t know… Maybe something about the compiler? But I can’t change the compiler either. I need to use compiler 0.6.6.

Your path goes to a contract, you are not looking to deploy the LinkToken.sol.

The correct path is @chainlink/contracts/truffle/v0.4/LinkToken which leads to a JS file.
(Advice, you should not modify any of the files provided by the nodes_modules folder)

Carlos Z

Ok, ok I have news! That path is now correct, but… the problem now is kinda weird.

It seems it can’t find @chainlink/contracts/truffle/v0.4/LinkToken but that file is already in truffle/v4.0 as you can see in my project.


I’m not getting it :frowning:

I changed the path to ../node_modules/@chainlink/contracts/truffle/v0.4/LinkToken because the contracts are in node_modules folder. It seems it works but now I’m getting another error (Jesus…). This time related to web3:


I’ve tried npm install web3 already but it didn’t work. I suspect that this Chainlink deployment does not come with the web3 configuration files, is that possible? For example, in another Truffle project I have a src folder where inside there is an index.html and there is also the app.js file. But in my Chainlink project I don’t find that file (it is not by default…).

P.D: but I have app.config.json and package.json… Sorry I’m totally lost with this error.

Hey @Joncarre

Let’s try to install web3 globally first. Run npm i -g web3.
Then try again to deploy your project.

Keep us posted,

Thanks for help man. I’ve installed it on Linux and it’s working :slight_smile:

1 Like