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

Cannot compile contracts in v5.9.1 #6066

Closed
1 task done
calebyouki opened this issue Jun 2, 2023 · 11 comments
Closed
1 task done

Cannot compile contracts in v5.9.1 #6066

calebyouki opened this issue Jun 2, 2023 · 11 comments

Comments

@calebyouki
Copy link


Issue

When trying to compile contracts programmatically in v5.9.1, the 'Resolver is not a constructor' error is thrown.

Steps to Reproduce

With truffle v5.9.1 and default test config, run the following command in Javascript:
await truffle.contracts.compile(config);

Expected Behavior

Contract is compiled successfully.

Actual Results

The following error is thrown:
TypeError: Resolver is not a constructor   at prepareConfig (/xxx/node_modules/truffle/build/webpack:/packages/workflow-compile/legacy/index.js:28:1)   at Object.compile (/xxx/node_modules/truffle/build/webpack:/packages/workflow-compile/legacy/index.js:64:1)   at plugin (/xxx/plugins/truffle.plugin.js:88:32)     at processTicksAndRejections (node:internal/process/task_queues:96:5)   at run (/xxx/debug.js:11:5)

Error seems to be coming from this line.

Environment

  • Operating System: Linux
  • Ethereum client: ganache-core v2.13.2
  • Truffle version (truffle version): v5.9.1
  • node version (node --version): v16.18.1
  • npm version (npm --version): 8.19.2
@haltman-at
Copy link
Contributor

Could you provide more detailed reproduction information? Do you perhaps have a reproduction project we could check out? Thank you!

(Some particular things I'm confused about -- when you say "execute the following command in Javascript", where? What is the truffle variable here, and what context is this running in? Thanks!)

@covendev
Copy link

covendev commented Jun 3, 2023

To add on here, I'm facing a similar issue as well while deploying to linea testnet:

*** Deployment Failed ***
"CloudNineNFTProject" hit an invalid opcode while deploying. Try:

  • Verifying that your constructor params satisfy all assert conditions.
  • Verifying your constructor code doesn't access an array out of bounds.
  • Adding reason strings to your assert statements.
    Exiting: Review successful transactions manually by checking the transaction hashes above on Etherscan.
    Error: *** Deployment Failed ***
    "CloudNineNFTProject" hit an invalid opcode while deploying. Try:
  • Verifying that your constructor params satisfy all assert conditions.
  • Verifying your constructor code doesn't access an array out of bounds.
  • Adding reason strings to your assert statements.
    at Users/.nvm/versions/node/v18.16.0/lib/node_modules/truffle/build/webpack:/packages/deployer/src/deployment.js:330:1
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
    Truffle v5.9.3 (core: 5.9.3)
    Node v18.16.0

while running the following command - truffle migrate --network linea

@calebyouki
Copy link
Author

Could you provide more detailed reproduction information? Do you perhaps have a reproduction project we could check out? Thank you!

(Some particular things I'm confused about -- when you say "execute the following command in Javascript", where? What is the truffle variable here, and what context is this running in? Thanks!)

Hi @haltman-at , I am currently importing the truffle library using const truffle = require("truffle");

I am running it in a similar context (with similar config) as this file.

Btw, I also experience the same issue when running with the latest v5.9.3.

@haltman-at
Copy link
Contributor

@covendev, your issue would appear to be unrelated. I suggest opening a new issue if you want to discuss that.

@Reguzz
Copy link

Reguzz commented Jun 8, 2023

Issue

When trying to compile contracts programmatically in v5.9.2, the 'Resolver is not a constructor' error is thrown.

Terminal error

> Using Truffle library from global node_modules.

> server:            http://127.0.0.1:8545
> truffle:           v5.9.2
> ganache-core:      v2.13.2
> solidity-coverage: v0.7.16

Network Info
============
> id:      *
> port:    8545
> network: development


Instrumenting for coverage...
=============================

> ComplexStorage.sol
> interfaces/IWhitelist.sol
> SimpleStorage.sol
> Token.sol
> Whitelist.sol
> solidity-coverage cleaning up, shutting down ganache server
TypeError: Resolver is not a constructor
    at prepareConfig (/home/reguzz/.nvm/versions/node/v18.16.0/lib/node_modules/truffle/build/webpack:/packages/workflow-compile/legacy/index.js:28:1)
    at Object.compile (/home/reguzz/.nvm/versions/node/v18.16.0/lib/node_modules/truffle/build/webpack:/packages/workflow-compile/legacy/index.js:64:1)
    at plugin (/home/reguzz/divercitylabs/masterzdev/SimpleStorage/node_modules/solidity-coverage/plugins/truffle.plugin.js:97:29)
    at processTicksAndRejections (node:internal/process/task_queues:95:5)
Truffle v5.9.2 (core: 5.9.2)
Node v18.16.0

Environment

  • Operating System: Ubuntu 22.04.1 LTS on Windows WSL v2
  • Ethereum client: ganache-core: v2.13.2
  • Truffle version: v5.9.2
  • node version: v18.16.0
  • npm version: 9.6.7

Repo

you can find my repo here

@cliffoo
Copy link
Contributor

cliffoo commented Jun 8, 2023

Thanks for the repo @Reguzz! We'll look into this.

@eggplantzzz
Copy link
Contributor

So it looks like we updated the exports in the resolver package and neglected to update the import in the legacy workflow compile package, yikes! I put in #6078 to fix this.

@haltman-at
Copy link
Contributor

OK, we've released the fix in Truffle 5.10.0; I'm going to close this issue now, but let us know if there's still a problem!

@calebyouki
Copy link
Author

Thanks @haltman-at for the update! Created #6105 to follow up

@RumeelHussainbnb
Copy link

I tried changing the compiler versions in the truffle config file. It works fine for older versions, but there's still the same error if the compiler is set to ^0.8.0 or 0.8.20 which is the latest version.

image

@haltman-at
Copy link
Contributor

@RumeelHussainbnb That would appear to be an unrelated issue. I would suggest filing a new issue for that.

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

No branches or pull requests

7 participants