5

I'm trying to use Truffle to test some contracts by following their docs. As specified, I have installed truffle, testrpc, created the migration contract and worked fine.

Ran truffle compile

$ truffle compile
Compiling ./contracts/User1.sol...
Compiling ./contracts/User2.sol...
Compiling ./contracts/Registry.sol...

Writing artifacts to ./build/contracts

and truffle migrate

$ truffle migrate
Using network 'development'.

Network up to date.

and both seemed ok.

The problem was running trying to interact with a contract using truffe console

$ truffle console
Unexpected error: Cannot provision contracts while instantiating the console.
: Unexpected end of JSON input
    at /usr/local/lib/node_modules/truffle/build/cli.bundled.js:213724:27
    at tryToString (fs.js:456:3)
    at FSReqWrap.readFileAfterClose [as oncomplete] (fs.js:443:12)
truffle(development)> User1.deployed()
ReferenceError: User1 is not defined

If it helps, the structure of the dir is

├── build
│   ├── Icon\r
│   └── contracts
│       ├── ConvertLib.json
│       ├── User1.json
│       ├── Icon\r
│       ├── MetaCoin.json
│       ├── Migrations.json
│       ├── User2.json
│       ├── Registry.json
│       ├── Storage.json
├── contracts
│   ├── User1.sol
│   ├── Migrations.sol
│   ├── User2.sol
│   ├── Registry.sol
├── migrations
│   ├── 1_initial_migration.js
│   ├── 2_user1_migration.sol
│   ├── 3_user2_migration.sol
│   ├── 4_registry_migration.sol
│   └── Icon\r
├── test
│   ├── Icon\r
│   ├── TestMetacoin.sol
│   └── metacoin.js
└── truffle.js

How can I fix this?

1

I asked on Truffle's Gitter and the way to solve it was by creating another directory and changing the project there. Also, my default documents folder is on Google Drive and I've found that whenever I had issues like this (also had a private ethereum blockchain that would't start), moving it to a folder which is not on Google Drive (Desktop, etc.) would make it work.

Not sure if this is really a thing or not but could be worth a try if you're stuck in the same situation.

  • "my default documents folder is on Google Drive" bahah – 0TTT0 Feb 20 '18 at 3:36
  • Thanks. Saved lot of debugging on my side. Don't know why Google Drive syncing should be an issue. – Parth Patel Apr 3 at 0:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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