I'm new with blockchain development. I'm working on an old project which use solidity 0.4.17 and truffle ^4.0.0-beta.2; These versions were in the package.json file of the project.

When I installed truffle and solidity globally, it installed the latest version for them. And the project was also using these latest versions(check with "truffle version" command). But when I changed old pragma versions to the latest, the project had a lot of errors and warnings(too many to handle manually). So I decided to downgrade truffle and solc to be able to compile the project.

The project finally compiled and some of the tests passed successfully. But when I tried running "npm run coverage" it couldn't find these files from one of the contract:

import "truffle/Assert.sol";
import "truffle/DeployedAddresses.sol";

Then I found Assert.sol file in truffle repo on github and referenced it from node_modules. but new error is this:

Error: Could not find truffle/AssertString.sol from any sources; imported from truffle/Assert.sol
    at C:\Users\giusha9\Desktop\Authcoin-Qtum-master-old-version\node_modules\truffle\build\cli.bundled.js:59552:23
    at C:\Users\giusha9\Desktop\Authcoin-Qtum-master-old-version\node_modules\truffle\build\cli.bundled.js:155895:16
    at next (C:\Users\giusha9\Desktop\Authcoin-Qtum-master-old-version\node_modules\truffle\build\cli.bundled.js:167654:18)
    at C:\Users\giusha9\Desktop\Authcoin-Qtum-master-old-version\node_modules\truffle\build\cli.bundled.js:59540:7
    at C:\Users\giusha9\Desktop\Authcoin-Qtum-master-old-version\node_modules\truffle\build\cli.bundled.js:190397:5
    at C:\Users\giusha9\Desktop\Authcoin-Qtum-master-old-version\node_modules\truffle\build\cli.bundled.js:167559:16
    at replenish (C:\Users\giusha9\Desktop\Authcoin-Qtum-master-old-version\node_modules\truffle\build\cli.bundled.js:155865:25)
    at iterateeCallback (C:\Users\giusha9\Desktop\Authcoin-Qtum-master-old-version\node_modules\truffle\build\cli.bundled.js:155855:17)
    at C:\Users\giusha9\Desktop\Authcoin-Qtum-master-old-version\node_modules\truffle\build\cli.bundled.js:155895:16
    at ReadFileContext.callback (C:\Users\giusha9\Desktop\Authcoin-Qtum-master-old-version\node_modules\truffle\build\cli.bundled.js:190393:14)
Cleaning up...

This is the package.json:

"scripts": {
    "compile": "truffle compile",
    "build": "truffle build",
    "deploy": "truffle deploy",
    "postinstall": "truffle install",
    "console": "truffle console",
    "testrpc": "testrpc --gasLimit 60000000",
    "testrpc:coverage": "node_modules/.bin/testrpc-sc --port 8555",
    "truffle-test": "truffle test",
    "test": "run-p --aggregate-output --race testrpc truffle-test",
    "solidity-coverage": "node_modules/.bin/solidity-coverage",
    "coverage": "run-p --aggregate-output --race testrpc:coverage solidity-coverage",
    "lint": "node_modules/.bin/solium --dir ./contracts"
  "devDependencies": {
    "concurrently": "^3.5.0",
    "ethereumjs-testrpc": "^6.0.3",
    "npm-run-all": "^4.1.1",
    "solidity-coverage": "^0.2.7",
    "solium": "^0.5.5",
    "truffle": "v4.0.0-beta.2",
    "ethereumjs-util": "^5.1.2"
  "dependencies": {
    "chai": "^4.1.2"

I have three questions:

  1. How can I solve this last error about assert.sol and DeployedAddresses.sol?

  2. Does it worth to downgrade solidity and truffle versions? because it seems that these last errors won't be the last one I have to deal with, It seems that a lot has changed since 0.4.17 version.

  3. If I will use a new version of truffle and solidity is there any way to avoid basically rewriting all of the contracts?

Any help will be appreciated.

3 Answers 3


Solidity got bunch on backward incompatible changes between 0.4.24 (last released 0.4.x version) and 0.5.0. Strictly speaking, solidity 0.4.x and 0.5.x are different programming languages, and the former is not maintained anymore. You have to either modify your code to comply with Solidity 0.5.x, or install solidity 0.4.24 side by side with 0.5.x and make Truffle to use older Solidity for older projects.


You should be able to ignore the globally installed Truffle and use the version requested in package.json.


$ npm install

The run truffle from ./node_modules/.bin

So ...

$ ./node_modules/.bin/truffle compile

Done that way, the hope is it will find the required compiler and also the dependencies.

Hope it helps.

  • Thank you for your answer. But currently, I had the same version installed globally as it's in package.json, so it wasn't a problem.
    – GiorgiSh
    Apr 7, 2019 at 9:36

I think your project is very old (more than 1 year in blockchain is a long time), and it is possible some of the dependencies do not match very well, ie solidity-coverage, truffle has had a lot changes.

I'd suggest to first try to pin the version of the dependencies, use a old version of node, inside a VM. This might be a lot of work so if after a couple of days I'd start thinking about porting to the new versions of the packages.

  • so you suggest updating every package to the oldest versions and try to fix errors like that? It seems that in both cases I have to deal with a lot of errors and I'm wondering which one will be less troublesome: try running with old versions of packages or upgrading them
    – GiorgiSh
    Apr 9, 2019 at 19:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.