ethereum / solc-js

Javascript bindings for the Solidity compiler
https://soliditylang.org
MIT License
1.45k stars 471 forks source link

`TypeError: Cannot read properties of undefined (reading '1')` in `solc.js` when passing the input for `--standard-json` via stdin #601

Open sava-1729 opened 2 years ago

sava-1729 commented 2 years ago

I tried running solcjs --standard-json

and the following output was produced:

node:fs:208
let mode = stats[1];
^
TypeError: Cannot read properties of undefined (reading '1')
←[90m at isFileType (node:fs:208:19)←[39m
←[90m at Object.readFileSync (node:fs:456:16)←[39m
at Object. (C:\Users\sriva\AppData\Roaming\npm\node_modules\←[4msolc←[24m\solcjs:128:18)
←[90m at Module._compile (node:internal/modules/cjs/loader:1101:14)←[39m
←[90m at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)←[39m
←[90m at Module.load (node:internal/modules/cjs/loader:981:32)←[39m
←[90m at Function.Module._load (node:internal/modules/cjs/loader:822:12)←[39m
←[90m at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)←[39m
←[90m at node:internal/main/run_main_module:17:47←[39m

The "^" isn't correctly placed in the above text; it was just below "[" in "let mode = stats[1];"

What's wrong here? solcjs --abi and solcjs --bin work perfectly well.

cameel commented 2 years ago

Thanks for reporting. This seems to be a problem with how we access stdin. I think it's related to #460.

lowk3v commented 4 months ago

I think the error related to version of Solc. When I downgrade a solc version to 0.8.0, I don't see the error