smartcontractkit / full-blockchain-solidity-course-js

Learn Blockchain, Solidity, and Full Stack Web3 Development with Javascript
12.55k stars 3k forks source link

Yarn solcjs - set up error #2621

Closed rmcividanes closed 2 years ago

rmcividanes commented 2 years ago

Lesson

Lesson 5

Could you please leave a link to the timestamp in the video where this error occurs? (You can right click a video and "copy video URL at current time")

https://youtu.be/gyMwXuJrbJQ?t=24799

Operating System

macOS (Apple Silicon)

Describe the bug

It gives me this error. Please help, I'm stuck.

Screen Shot 2022-09-16 at 10 24 34 AM

ricardomiguelcividanes@Ricardos-MacBook-Air hardhat - fcc % yarn solcjs --bin --abi -- include- path node_module s/ --base-path . -o . SimpleStorage.sol yarn run v1.22.15 warning package.json: No license field warning From Yarn 1.0 onwards, scripts don't require "--" for options to be forwarded. In a future version, any explicit "--" will be forwarded as-is to the scripts. $ '/Users/ricardomiguelcividanes/hardhat - fcc/node_modules/.bin/solcjs' include- path node_modules/ --base-path . -o . SimpleStorage.sol Invalid option selected, must specify either --bin or --abi error Command failed with exit code 1. info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

alymurtazamemon commented 2 years ago

@rmcividanes First run npm install solc and then

solcjs --bin --abi --include-path node_modules/ --base-path . -o . SimpleStorage.sol
asynctdm commented 2 years ago

Hey there , I faced a similar issue just yesterday with my M1 macbook air, These are the steps I took to get it working for me

Step 1

Updated my package.json file

{
  "name": "hardhat-simple-storage",
  "version": "1.0.0",
  "license": "MIT",
  "devDependencies": {
    "@nomiclabs/hardhat-ethers": "^2.0.0",
    "@nomiclabs/hardhat-etherscan": "^3.0.4",
    "@nomiclabs/hardhat-waffle": "^2.0.0",
    "chai": "^4.2.0",
    "dotenv": "^16.0.1",
    "ethereum-waffle": "^3.0.0",
    "ethers": "^5.0.0",
    "hardhat": "^2.9.7",
    "hardhat-gas-reporter": "^1.0.8",
    "solidity-coverage": "^0.7.21"
  },
  "dependencies": {
    "solc": "^0.8.17"
  }
}

Step 2

yarn add solc

Step 3

yarn solcjs --bin --abi --include-path node_modules/ --base-path . -o . simplestorage.sol

Also Check for Typo in the naming of your SimpleStorage.sol If you have named it correctly or not

krakxn commented 2 years ago

This does not seem like a code-bug; thus, discussions are more apt (also for others to refer to the solution)--please close here and post there!

rmcividanes commented 2 years ago

yarn solcjs --bin --abi --include-path node_modules/ --base-path . -o . simplestorage.sol

hey cardinalsama,

I don't know to thank you, I was about to quit this course, really appreciate it. This worked right away. Thank you.