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.

Could not find artifacts for ./Migrations.sol from any sources

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

Issue

when execute “truffle migrate --network dev” get this: Could not find artifacts for ./Migrations.sol from any sources

Steps to Reproduce

truffle.js
module.exports = {
  // See <http://truffleframework.com/docs/advanced/configuration>
  // to customize your Truffle configuration!
  contracts_build_directory: "./build",
  networks: {
    dev: {
      host: "localhost",
      port: 9545,
      network_id: "*",
    }
  }
};
  1. truffle unbox metacoin
  2. truffle compile
  3. truffle migrate --network dev

Expected Behavior

Using network ‘dev’.

Network up to date.

Actual Results

Using network ‘dev’.

Running migration: 1_initial_migration.js /usr/local/nodejs/lib/node_modules/truffle/build/cli.bundled.js:63556 throw new Error(“Could not find artifacts for " + import_path + " from any sources”); ^

Error: Could not find artifacts for ./Migrations.sol from any sources at Resolver.require (/usr/local/nodejs/lib/node_modules/truffle/build/cli.bundled.js:63556:9) at Object.require (/usr/local/nodejs/lib/node_modules/truffle/build/cli.bundled.js:176187:36) at ResolverIntercept.require (/usr/local/nodejs/lib/node_modules/truffle/build/cli.bundled.js:324348:32) at /home/leo/Documents/src_codes/dapp/demo/migrations/1_initial_migration.js:1:28 at ContextifyScript.Script.runInContext (vm.js:59:29) at ContextifyScript.Script.runInNewContext (vm.js:65:15) at /usr/local/nodejs/lib/node_modules/truffle/build/cli.bundled.js:203486:14 at FSReqWrap.readFileAfterClose [as oncomplete] (fs.js:511:3)

Environment

  • Operating System: ubuntu 16.04
  • Truffle version: 4.0.3
  • Ethereum client: geth
  • node version: 8.9.3
  • npm version: 5.6.0

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:11 (1 by maintainers)

github_iconTop GitHub Comments

16reactions
kushan-gunasekeracommented, Jun 17, 2018

I got the same problem just now, but I solved it in this way.

  • After your compilation, go to your_folder_location\build\contracts folder.

  • Then you will see a JSON file which not related to your contract file.

  • Just rename that JSON file same as your contract file. ( most probably that JSON file related your folder name )

  • But after that you can see the renamed file as well as the original file too, both files in same location. Don’t worry.

That’s it.

3reactions
raphaelpgcommented, Dec 17, 2019

I got the same problem just now, but I solved it in this way.

* After your compilation, go to `your_folder_location\build\contracts` folder.

* Then you will see a JSON file which not related to your contract file.

* Just rename that JSON file same as your contract file. ( most probably that JSON file related your folder name )

* But after that you can see the renamed file as well as the original file too, both files in same location. Don't worry.

That’s it.

Worked. To avoid this issue, make sure your contract’s and the contract file has the same name: ie: "pragma solidity 0.5.12;

contract Token20 { … " in file named Token20.sol

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 >
HELP** Error("Could not find artifacts for " + import_path + ...
The problem is that the file.sol and the file.js that calls the contract in the migration folder can't be named the same, it...
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 >
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 Reddit Thread

No results found

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