Skip to content
This repository has been archived by the owner on Feb 26, 2024. It is now read-only.

Migrating fails (Ganache and Truffle Develop) #3991

Closed
1 task done
gideongrinberg opened this issue Apr 21, 2021 · 9 comments
Closed
1 task done

Migrating fails (Ganache and Truffle Develop) #3991

gideongrinberg opened this issue Apr 21, 2021 · 9 comments

Comments

@gideongrinberg
Copy link

  • I've asked for help in the Truffle Gitter before filing this issue. (It was ~15 minutes ago, but I figured I'd fill out an issue anyway. I also asked on the Etherum Discord)

Issue

Truffle is unable to find contracts in a subdirectory when I'm using ganache.

Steps to Reproduce

First Attempt:

  1. truffle init to create a new project
  2. Write contracts into contracts/ and tests into tests/ (all contracts compiled and all tests passed.
  3. Start Ganache, add a network in truffle-config.js
  4. Run truffle migrate --network development

Second Attempt:

  1. Steps 1 and 2 of the above
  2. truffle develop and then migrate
  3. This errors out as well.

Expected Behavior

The contracts would've compiled and migrated.

Actual Results

First Attempt:

Truffle couldn't find some of the files (all of which had worked for first time.) See this gist for the source and the error messages.

Second attempt:

New error. See this Gist.

Environment

  • Operating System: macOS Catalina 10.15.7
  • Ethereum client: Ganache
  • Truffle version (truffle version): I've tried bot Truffle v4.1.14 and truffle@latest
  • node version (node --version): v15.1.0
  • npm version (npm --version): 7.0.8

There's a 99% chance I'm making a dumb mistake somewhere in these steps. Thanks in advance for any help!

(I'm also aware that these are two separate issues, but I'll leave them as one for now)

@gideongrinberg
Copy link
Author

Possibly a duplicate of #2463, and related to #2070

@gideongrinberg
Copy link
Author

Upgrading truffle caused yet another error, this time due to my solc version being wrong. I think I can fix that myself, so I'll close this.

@gideongrinberg
Copy link
Author

With the newest version of Truffle, and solc@4.24.0, it still fails with the same error about not being able to find files.

/Users/GideonGrinberg/.npm-global/lib/node_modules/truffle/build/459.bundled.js:25498
        throw new Error("Could not find artifacts for " + import_path + " from any sources");
        ^

Error: Could not find artifacts for Classes/Rouge from any sources
    at Resolver.require (/Users/GideonGrinberg/.npm-global/lib/node_modules/truffle/build/webpack:/packages/resolver/dist/lib/resolver.js:61:1)
    at Object.require (/Users/GideonGrinberg/.npm-global/lib/node_modules/truffle/build/webpack:/packages/migrate/index.js:172:1)
    at ResolverIntercept.require (/Users/GideonGrinberg/.npm-global/lib/node_modules/truffle/build/webpack:/packages/migrate/ResolverIntercept.js:22:1)
    at /Users/GideonGrinberg/Coding/ether-adventure/src/migrations/2_game_migration.js:4:23
    at Script.runInContext (node:vm:142:18)
    at Script.runInNewContext (node:vm:147:17)
    at Object.file (/Users/GideonGrinberg/.npm-global/lib/node_modules/truffle/build/webpack:/packages/require/require.js:94:1)
    at Migration._load (/Users/GideonGrinberg/.npm-global/lib/node_modules/truffle/build/webpack:/packages/migrate/Migration.js:49:1)
    at processTicksAndRejections (node:internal/process/task_queues:93:5)
    at Migration.run (/Users/GideonGrinberg/.npm-global/lib/node_modules/truffle/build/webpack:/packages/migrate/Migration.js:212:1)
    at Object.runMigrations (/Users/GideonGrinberg/.npm-global/lib/node_modules/truffle/build/webpack:/packages/migrate/index.js:150:1)
    at Object.runFrom (/Users/GideonGrinberg/.npm-global/lib/node_modules/truffle/build/webpack:/packages/migrate/index.js:110:1)
    at Object.run (/Users/GideonGrinberg/.npm-global/lib/node_modules/truffle/build/webpack:/packages/migrate/index.js:87:1)
    at runMigrations (/Users/GideonGrinberg/.npm-global/lib/node_modules/truffle/build/webpack:/packages/core/lib/commands/migrate.js:263:1)
    at Object.run (/Users/GideonGrinberg/.npm-global/lib/node_modules/truffle/build/webpack:/packages/core/lib/commands/migrate.js:228:1)
    at Command.run (/Users/GideonGrinberg/.npm-global/lib/node_modules/truffle/build/webpack:/packages/core/lib/command.js:140:1)

@gnidan
Copy link
Contributor

gnidan commented Apr 21, 2021

@gideongrinberg you'll want to do artifacts.require("Rogue") rather than artifacts.require("Classes/Rogue"), since the string passed to that function is meant to be just the contract name, not a path.

Not sure why you're getting that uncaughtException error, but maybe try fixing your artifacts.require statement and seeing if that helps?

Thanks for reporting this!

@gideongrinberg
Copy link
Author

Thanks for the reply @gnidan. It still doesn't work, same error:

truffle migrate --network development                                                                                                               [17:13:39]

Compiling your contracts...
===========================
> Everything is up to date, there is nothing to compile.



Starting migrations...
======================
> Network name:    'development'
> Network id:      5555
> Block gas limit: 6721975 (0x6691b7)


2_game_migration.js
===================

/Users/GideonGrinberg/.npm-global/lib/node_modules/truffle/build/459.bundled.js:25498
        throw new Error("Could not find artifacts for " + import_path + " from any sources");
        ^

Error: Could not find artifacts for Rouge from any sources
    at Resolver.require (/Users/GideonGrinberg/.npm-global/lib/node_modules/truffle/build/webpack:/packages/resolver/dist/lib/resolver.js:61:1)
    at Object.require (/Users/GideonGrinberg/.npm-global/lib/node_modules/truffle/build/webpack:/packages/migrate/index.js:172:1)
    at ResolverIntercept.require (/Users/GideonGrinberg/.npm-global/lib/node_modules/truffle/build/webpack:/packages/migrate/ResolverIntercept.js:22:1)
    at /Users/GideonGrinberg/Coding/ether-adventure/src/migrations/2_game_migration.js:6:23
    at Script.runInContext (node:vm:142:18)
    at Script.runInNewContext (node:vm:147:17)
    at Object.file (/Users/GideonGrinberg/.npm-global/lib/node_modules/truffle/build/webpack:/packages/require/require.js:94:1)
    at Migration._load (/Users/GideonGrinberg/.npm-global/lib/node_modules/truffle/build/webpack:/packages/migrate/Migration.js:49:1)
    at processTicksAndRejections (node:internal/process/task_queues:93:5)
    at Migration.run (/Users/GideonGrinberg/.npm-global/lib/node_modules/truffle/build/webpack:/packages/migrate/Migration.js:212:1)
    at Object.runMigrations (/Users/GideonGrinberg/.npm-global/lib/node_modules/truffle/build/webpack:/packages/migrate/index.js:150:1)
    at Object.runFrom (/Users/GideonGrinberg/.npm-global/lib/node_modules/truffle/build/webpack:/packages/migrate/index.js:110:1)
    at Object.run (/Users/GideonGrinberg/.npm-global/lib/node_modules/truffle/build/webpack:/packages/migrate/index.js:87:1)
    at runMigrations (/Users/GideonGrinberg/.npm-global/lib/node_modules/truffle/build/webpack:/packages/core/lib/commands/migrate.js:263:1)
    at Object.run (/Users/GideonGrinberg/.npm-global/lib/node_modules/truffle/build/webpack:/packages/core/lib/commands/migrate.js:228:1)
    at Command.run (/Users/GideonGrinberg/.npm-global/lib/node_modules/truffle/build/webpack:/packages/core/lib/command.js:140:1)
Truffle v5.3.2 (core: 5.3.2)
Node v15.1.0

@cds-amal
Copy link
Member

Hi @gideongrinberg, is it possible to share your project with us? It will help us troubleshoot the entire workflow. Thanks!

@gideongrinberg
Copy link
Author

Hi @gideongrinberg, is it possible to share your project with us? It will help us troubleshoot the entire workflow. Thanks!

Thanks for the response! I'm actually not sure if I still have the project, I'll see if I can find it.

@eggplantzzz
Copy link
Contributor

Thanks @gideongrinberg! That would be super helpful! I can't duplicate your error from the steps you gave. I tried on Node 15 and it seemed to run just fine. I wonder what could be going on here...

@gideongrinberg
Copy link
Author

Thanks @gideongrinberg! That would be super helpful! I can't duplicate your error from the steps you gave. I tried on Node 15 and it seemed to run just fine. I wonder what could be going on here...

I can't seem to find the project. I must've migrated it to hardhat before committing. It's very likely I made a dumb mistake somewhere. Thanks for all your help!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants