question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error: Could not find artifacts for " + import_path + " from any sources

See original GitHub issue
  • I’ve asked for help in the Truffle Gitter before filing this issue.

Issue

truffle(develop)> migrate --reset Compiling .\contracts\MetaCoin.sol… Writing artifacts to .\build\contracts

Using network ‘develop’.

Running migration: 1_initial_migration.js Replacing Migrations… … 0xbe08a360a53514f1751645230046ad03034f2ce3fc6ae2591ecfd34069c67e6a Migrations: 0x8cdaf0cd259887258bc13a92c0a6da92698644c0 Saving successful migration to network… … 0xd7bc86d31bee32fa3988f1c1eabce403a1b5d570340a3a9cdba53a472ee8c956 Saving artifacts… Running migration: 2_deploy_contracts.js C:\Users\labo\AppData\Roaming\npm\node_modules\truffle\build\cli.bundled.js:66536 throw new Error(“Could not find artifacts for " + import_path + " from any sources”); ^

Error: Could not find artifacts for ./MetaCoin.sol from any sources at Resolver.require (C:\Users\labo\AppData\Roaming\npm\node_modules\truffle\build\cli.bundled.js:66536:9) at Object.require (C:\Users\labo\AppData\Roaming\npm\node_modules\truffle\build\cli.bundled.js:77630:36) at ResolverIntercept.require (C:\Users\labo\AppData\Roaming\npm\node_modules\truffle\build\cli.bundled.js:239478:32)

at C:\Windows\system32\metacoin\migrations\2_deploy_contracts.js:2:26
at Script.runInContext (vm.js:74:29)
at Script.runInNewContext (vm.js:80:15)
at C:\Users\labo\AppData\Roaming\npm\node_modules\truffle\build\cli.bundled.js:125917:14
at FSReqWrap.readFileAfterClose [as oncomplete] (fs.js:532:3)

Environment

  • Operating System: Windows

  • Truffle version (truffle version): truffle v 4.1.3

  • node version (node --version):v9.9.0

  • npm version (npm --version): v 5.8.0

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:15 (3 by maintainers)

github_iconTop GitHub Comments

124reactions
alacretcommented, Aug 1, 2018

Make sure you have the Migrations.sol and that the name of the contract is the same as the name of the file, that solved the issue for me.

8reactions
heyJonBraycommented, Oct 13, 2020

I was having the same issue and it came down to the MyContract.sol file being in the main project directory instead of the ../contracts/ directory. Also ensure that you have a constructor in your contract that initializes the code you’re trying to run.

As @pianchemist said, truffle init turns the folder in which you run the command into the staging directory for your project and sets up standard default files and structure. The creation of files after this and placing them in the correct directories are up to you. For simple projects, having your contract within the contracts directory is as complex as it needs to be. For larger projects, it works like any other programming structure: you may have a folder that contains library code, or a hierarchy of contracts depending on the complexity of your project.

Regardless of size and complexity, ensure that your config is pointing to the correct locations using the staging directory as the root of the project. Ensure that any import statements also point to the correct location.

Read more comments on GitHub >

github_iconTop Results From Across the Web

The reason for "Could not find artifacts for" in truffle?
Error : Could not find artifacts for Migrations from any sources. I started my project from scratch by creating the contracts folder and...
Read more >
Why Could not find artifacts for contract from any sources
There is a typo in your contract name SolnSqaureVerifier , it should be SolnSquareVerifier.
Read more >
Solve truffle's "Could not find artifacts for import_path from any ...
Let's look at the third sentence: "Error: Could not find artifacts for ZhouWuToken from any sources" This line tells us that the contract ......
Read more >
Truffle can not find artifacts error | Edureka Community
I have written a smart contract and try to run it using truffle. When I try to migrate the project, I am getting...
Read more >
Cannot find artifacts error when running test - Blockgeeks.com
1) TestElection “before all” hook: prepare suite: Error: Could not find artifacts for /J/Joe/Blockchain/election/contracts/Election.sol from any sources.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found