PatrickAlphaC / ethers-simple-storage-fcc

90 stars 128 forks source link

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

Open tamermint opened 10 months ago

tamermint commented 10 months ago

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 solc@0.8.7-fixed
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
└─ solc@0.8.7-fixed
info All dependencies
├─ balanced-match@1.0.2
├─ brace-expansion@1.1.11
├─ commander@3.0.2
├─ concat-map@0.0.1
├─ fs-extra@0.30.0
├─ fs.realpath@1.0.0
├─ glob@7.2.3
├─ graceful-fs@4.2.11
├─ inflight@1.0.6
├─ inherits@2.0.4
├─ jsonfile@2.4.0
├─ klaw@1.3.1
├─ minimatch@3.1.2
├─ require-from-string@2.0.2
├─ rimraf@2.7.1
└─ solc@0.8.7-fixed
✨  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 solc@0.8.7-fixed 
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
└─ global@4.4.0
info All dependencies
├─ dom-walk@0.1.2
├─ global@4.4.0
├─ min-document@2.19.0
└─ process@0.11.10
✨  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

PatrickAlphaC commented 10 months ago

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

Okpainmo commented 9 months ago

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.

Ayush242 commented 9 months ago

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