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

TypeError: Cannot read property 'bytecode' of undefined #89

Closed
maximilianh opened this issue Feb 11, 2016 · 3 comments
Closed

TypeError: Cannot read property 'bytecode' of undefined #89

maximilianh opened this issue Feb 11, 2016 · 3 comments

Comments

@maximilianh
Copy link

I'm getting a very strange error here, the only thing I did is that I copied the example MetaCoin.sol to another file:



$ cd contracts
$ cp MetaCoin.sol t.sol
$ cd ..
truffle compile
Compiling ./contracts/MetaCoin.sol...
Compiling ./contracts/t.sol...
/usr/local/lib/node_modules/truffle/node_modules/solc/bin/soljson-latest.js:1
(function (exports, require, module, __filename, __dirname) { var Module;if(!Module)Module=(typeof Module!=="undefined"?Module:null)||{};var moduleOverrides={};for(var key in Module){if(Module.hasOwnProperty(key)){moduleOverrides[key]=Module[key]}}var ENVIRONMENT_IS_WEB=typeof window==="object";var ENVIRONMENT_IS_WORKER=typeof importScripts==="function";var ENVIRONMENT_IS_NODE=typeof process==="object"&&typeof require==="function"&&!ENVIRONMENT_IS_WEB&&!ENVIRONMENT_IS_WORKER;var ENVIRONMENT_IS_SHELL=!ENVIRONMENT_IS_WEB&&!ENVIRONMENT_IS_NODE&&!ENVIRONMENT_IS_WORKER;if(ENVIRONMENT_IS_NODE){if(!Module["print"])Module["print"]=function print(x){process["stdout"].write(x+"\n")};if(!Module["printErr"])Module["printErr"]=function printErr(x){process["stderr"].write(x+"\n")};var nodeFS=require("fs");var nodePath=require("path");Module["read"]=function read(filename,binary){filename=nodePath["normalize"](filename);var ret=nodeFS["readFileS

TypeError: Cannot read property 'bytecode' of undefined
  at /usr/local/lib/node_modules/truffle/lib/contracts.es6:171:45
  at /usr/local/lib/node_modules/truffle/node_modules/async/lib/async.js:356:13
  at Immediate.iterate [as _onImmediate] (/usr/local/lib/node_modules/truffle/node_modules/async/lib/async.js:262:13)
  at processImmediate [as _immediateCallback] (timers.js:383:17)
  at Function.module.exports.loopWhile (/usr/local/lib/node_modules/truffle/node_modules/deasync/index.js:64:21)
  at /usr/local/lib/node_modules/truffle/node_modules/deasync/index.js:36:18
  at runTask (/usr/local/lib/node_modules/truffle/truffle.es6:55:5)
  at Object.<anonymous> (/usr/local/lib/node_modules/truffle/truffle.es6:362:14)
  at Module._compile (module.js:413:34)
  at normalLoader (/usr/local/lib/node_modules/truffle/node_modules/babel-core/lib/api/register/node.js:199:5)
  at Object.require.extensions.(anonymous function) [as .es6] (/usr/local/lib/node_modules/truffle/node_modules/babel-core/lib/api/register/node.js:216:7)
  at Module.load (module.js:357:32)
  at Function.Module._load (module.js:314:12)
  at Function.Module.runMain (module.js:447:10)
  at Object.<anonymous> (/usr/local/lib/node_modules/truffle/node_modules/babel/lib/_babel-node.js:144:25)
  at Module._compile (module.js:413:34)
  at Object.Module._extensions..js (module.js:422:10)
  at Module.load (module.js:357:32)
  at Function.Module._load (module.js:314:12)
  at Function.Module.runMain (module.js:447:10)
  at startup (node.js:140:18)
  at node.js:1001:3

npm --version
3.7.2
Truffle v0.3.1
nodejs --version
v5.6.0

$ cat truffle.json 
{
  "build": {
    "index.html": "index.html",
    "app.js": [
      "javascripts/app.js"
    ],
    "app.css": [
      "stylesheets/app.css"
    ],
    "images/": "images/"
  },
  "deploy": [
    "MetaCoin", "t"
  ],
  "rpc": {
    "host": "localhost",
    "port": 8545
  }
}

$ sudo npm install -g truffle
npm WARN deprecated [email protected]: lodash@<3.0.0 is no longer maintained. Upgrade to lodash@^4.0.0
npm WARN deprecated [email protected]: this package has been reintegrated into npm and is now out of date with respect to npm
/usr/local/bin/truffle -> /usr/local/lib/node_modules/truffle/truffle.bash
/usr/local/bin/truffle-exec -> /usr/local/lib/node_modules/truffle/truffle-exec.bash
/usr/local/lib
└─┬ [email protected] 
  └─┬ [email protected]
    └── [email protected]  (git://github.com/debris/bignumber.js.git#94d7146671b9719e00a09c29b01a691bc85048c2)

npm WARN optional Skipping failed optional dependency /truffle/chokidar/fsevents:
npm WARN notsup Not compatible with your operating system or architecture: [email protected]

@silly-n
Copy link

silly-n commented Feb 22, 2016

After some time, I've figured that the problem is with the names: *.sol files must bear the same name as the contracts inside and the same names must be in truffle.json.

If possible, it would be nice to catch these problems with a more helpful msg :)

@maximilianh
Copy link
Author

Oh, wow, thanks! Yes, this definitely needs a more helpful message...

@tcoulter tcoulter added this to the v0.4.0 milestone Feb 22, 2016
@tcoulter
Copy link
Contributor

Thanks guys! Looks like there's already another ticket for this: #60. I'm going to close this one, but know that this is tagged to be fixed in the next Truffle release.

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

3 participants