argotorg / argotorg/solc-js

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

Open
#601 2 comments 0 reactions 0 assignees View on GitHub
bug :bug: help wanted
Dominant language
TypeScript
Stars
1.5k
Forks
349
Avg merge
8m
Merged PRs (30d)
1

Description

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.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start at the solcjs entry point around line 128, where the stack trace shows readFileSync failing when --standard-json receives input through stdin. Reproduce the command with JSON piped to solcjs --standard-json and determine the expected stdin path; done means that invocation no longer raises the TypeError.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript
Domain
cli, compilers
Issue type
Bug
Difficulty
2/5
Estimated time
1-3 hours
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.