Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

solcjs --standard-json - TypeError: Second argument needs to be a buffer #126

Closed
Janaka-Steph opened this issue Jul 24, 2017 · 12 comments
Closed
Labels

Comments

@Janaka-Steph
Copy link

Hello,

solcjs --standard-json myinput.json doesn't work. See the error bellow.

$ echo "{}" | solcjs --standard-json
/usr/local/lib/node_modules/solc/node_modules/graceful-fs/polyfills.js:144
        throw er
        ^

TypeError: Second argument needs to be a buffer
    at Object.fs.readSync (fs.js:681:18)
    at Object.readSync (/usr/local/lib/node_modules/solc/node_modules/graceful-fs/polyfills.js:138:28)
    at Object.<anonymous> (/usr/local/lib/node_modules/solc/solcjs:65:18)
    at Module._compile (module.js:569:30)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:503:32)
    at tryModuleLoad (module.js:466:12)
    at Function.Module._load (module.js:458:3)
    at Function.Module.runMain (module.js:605:10)
    at startup (bootstrap_node.js:158:16)
@axic
Copy link
Member

axic commented Jul 24, 2017

Thanks, this seems to be a bug. solcjs --standardjson myinput.json will not work as it expects the content on the standard input (ie. piping). echo "{}" | solcjs --standard-json should work though.

@axic
Copy link
Member

axic commented Jul 25, 2017

Will push a fix soon.

@munawarb
Copy link

Hi,
I'm trying to execute this command: echo "{}" | solcjs --standard-json but getting an error: Empty input was read.

@chriseth
Copy link
Contributor

@munawarb the empty object is not enough, some of the fields are required. More information: https://solidity.readthedocs.io/en/develop/using-the-compiler.html#compiler-input-and-output-json-description

@axic
Copy link
Member

axic commented Aug 24, 2017

The Empty input was read is part of solcjs though, which is being addressed in #127.

@axic axic added the bug 🐛 label Sep 25, 2017
@mtbitcoin
Copy link

I am running into the exact issue, is there a workaround or fix?

@snd
Copy link

snd commented Jun 7, 2018

having the same issue.

is there any way to use the solcjs standard json interface at this point?

$ solcjs --version
0.4.24+commit.e67f0147.Emscripten.clang
$ echo "{}" | solcjs --standard-json
/usr/local/lib/node_modules/solc/node_modules/graceful-fs/polyfills.js:144
        throw er
        ^

TypeError: Second argument needs to be a buffer
    at Object.fs.readSync (fs.js:697:18)
    at Object.readSync (/usr/local/lib/node_modules/solc/node_modules/graceful-fs/polyfills.js:138:28)
    at Object.<anonymous> (/usr/local/lib/node_modules/solc/solcjs:65:18)
    at Module._compile (module.js:649:30)
    at Object.Module._extensions..js (module.js:660:10)
    at Module.load (module.js:561:32)
    at tryModuleLoad (module.js:501:12)
    at Function.Module._load (module.js:493:3)
    at Function.Module.runMain (module.js:690:10)
    at startup (bootstrap_node.js:194:16)

@munawarb
Copy link

munawarb commented Jun 8, 2018 via email

@axic
Copy link
Member

axic commented Jun 12, 2018

@snd there is the PR #127 trying to fix this, but no matter what, something works on Travis but doesn't work on a Mac, or vice versa, but mostly nothing works on Travis. Would you be interested in helping out?

@tzapu
Copy link

tzapu commented Jun 21, 2018

@axic i tried to fix the tests here #229, would love to be a be able to use standard jsons :D
thanks

@feuGeneA
Copy link

feuGeneA commented Aug 7, 2018

@axic , what's your disposition on this issue and the proposed fix?

I'm using the changes from @tzapu 's PR #229 , which seem to include your own changes as well, and it's all working for my purposes.

I'd love to see the fix merged into master so that I can go into production with my own development that's depending on it, and I see @snd and others are waiting on it as well.

Are there any reservations you have? Is there anything we can do to help facilitate?

@axic
Copy link
Member

axic commented Aug 7, 2018

Here's the last comment on the issue: #127 (comment)

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

No branches or pull requests

8 participants