ethers-simple-storage-fcc icon indicating copy to clipboard operation
ethers-simple-storage-fcc copied to clipboard

Solc needs to be globally added with Yarn for solcjs to work

Open tamermint opened this issue 1 year ago • 3 comments

Hey all, I don't know if this has been asked or reported, but apparently solc needs to be added globally for solcjs to be available via CLI :

yarn add [email protected]
yarn add v1.22.21
warning package.json: No license field
warning No license field
[1/4] 🔍  Resolving packages...
⠁ (node:47742) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
[2/4] 🚚  Fetching packages...
[3/4] 🔗  Linking dependencies...
[4/4] 🔨  Building fresh packages...
success Saved lockfile.
warning No license field
success Saved 16 new dependencies.
info Direct dependencies
└─ [email protected]
info All dependencies
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
└─ [email protected]
✨  Done in 2.06s.
vivekmitra@MBPro ethers-simple-storage-fcc % yarn solcjs --help
yarn run v1.22.21
warning package.json: No license field
error Command "solcjs" not found.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
yarn add global [email protected] 
yarn add v1.22.21
warning package.json: No license field
warning No license field
[1/4] 🔍  Resolving packages...
⠁ (node:48281) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
[2/4] 🚚  Fetching packages...
[3/4] 🔗  Linking dependencies...
[4/4] 🔨  Building fresh packages...
success Saved lockfile.
warning No license field
success Saved 4 new dependencies.
info Direct dependencies
└─ [email protected]
info All dependencies
├─ [email protected]
├─ [email protected]
├─ [email protected]
└─ [email protected]
✨  Done in 1.33s.
vivekmitra@MBPro ethers-simple-storage-fcc % solcjs --help
zsh: command not found: solcjs
vivekmitra@MBPro ethers-simple-storage-fcc % yarn solcjs --help
yarn run v1.22.21
warning package.json: No license field
$ /Users/vivekmitra/Desktop/hh-fcc/ethers-simple-storage-fcc/node_modules/.bin/solcjs --help
Usage: solcjs [options]

Options:
  -V, --version                        output the version number
  --version                            Show version and exit.
  --optimize                           Enable bytecode optimizer. (default: false)
  --bin                                Binary of the contracts in hex.
  --abi                                ABI of the contracts.
  --standard-json                      Turn on Standard JSON Input / Output mode.
  --base-path <path>                   Automatically resolve all imports inside the given path.
  -o, --output-dir <output-directory>  Output directory for the contracts.
  -h, --help                           output usage information
✨  Done in 0.71s.

I am not sure if anyone has experienced this issue or it has been reported but I wasn't able to find it in the questions/issues raised in this course. Please let me know if I am wrong/if this is a duplicate. Thanks

tamermint avatar Jan 26 '24 00:01 tamermint

Hmm... this shouldn't be the case, but if it's working for you for now, all good

PatrickAlphaC avatar Jan 31 '24 16:01 PatrickAlphaC

Same issue with me. It only seemed to work after I installed NPM globally - as I'm currently/prefer using NPM. But no worries since the global install fixed it.

Okpainmo avatar Feb 11 '24 01:02 Okpainmo

Same issue with me. It only seemed to work after I installed NPM globally - as I'm currently/prefer using NPM. But no worries since the global install fixed it.

for solc to work with npm, you have to use npx instead of npm like

  npx solcjs --help

Ayush242 avatar Feb 12 '24 07:02 Ayush242