Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Getting Error: EEXIST: file already exists, mkdir '.' #652

Open
reselbob opened this issue Aug 23, 2022 · 4 comments
Open

Getting Error: EEXIST: file already exists, mkdir '.' #652

reselbob opened this issue Aug 23, 2022 · 4 comments
Labels
waiting for more input Issues waiting for more input by the reporter

Comments

@reselbob
Copy link

Hi:

I run this command: solcjs --bin --include-path node_modules/ --base-path . LookupContract.sol

And get this result:

Warning: Visibility for constructor is ignored. If you want the contract to be non-deployable, making it "abstract" is sufficient.
 --> LookupContract.sol:9:1:
  |
9 | constructor (string memory _name, uint _mobileNumber) public {
  | ^ (Relevant source part starts here and spans across multiple lines).


fs.js:885
  return binding.mkdir(pathModule._makeLong(path),
                 ^

Error: EEXIST: file already exists, mkdir '.'
    at Object.fs.mkdirSync (fs.js:885:18)
    at Object.<anonymous> (/usr/local/lib/node_modules/solc/solc.js:232:4)
    at Module._compile (module.js:653:30)
    at Object.Module._extensions..js (module.js:664:10)
    at Module.load (module.js:566:32)
    at tryModuleLoad (module.js:506:12)
    at Function.Module._load (module.js:498:3)
    at Function.Module.runMain (module.js:694:10)
    at startup (bootstrap_node.js:204:16)
    at bootstrap_node.js:625:3

Here is the content of LookupContract.sol:

// SPDX-License-Identifier: GPL-3.0
pragma solidity >=0.7.0 <0.9.0;


contract LookupContract {

mapping (string => uint) public myDirectory;

constructor (string memory _name, uint _mobileNumber) public {
        myDirectory[_name] = _mobileNumber;
    }

function setMobileNumber(string memory _name, uint _mobileNumber) public {
        myDirectory[_name] = _mobileNumber;
    }

function getMobileNumber(string memory _name) public view returns (uint) {
        return myDirectory[_name];
    }

}

Here is my package.json

{
  "name": "first-hedera-contract-js-sdk",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "",
  "license": "ISC",
  "dependencies": {
    "@hashgraph/cryptography": "^1.4.0",
    "@hashgraph/sdk": "^2.18.0",
    "dotenv": "^16.0.1",
    "encoding": "^0.1.13",
    "expo": "^45.0.8",
    "expo-crypto": "^10.2.0",
    "expo-random": "^12.3.0"
  }
}

Help? I am jammed up.

Triple thanks in advance!

@reselbob
Copy link
Author

This works:

solcjs --bin ./LookupContract.sol -o ./bin

This is the result:

ls -lh ./bin
total 4.0K
-rw-r--r-- 1 root root 3.6K Aug 23 03:01 LookupContract_sol_LookupContract.bin

@r0qs
Copy link
Member

r0qs commented Sep 8, 2022

Hi @reselbob, what version of solcjs and nodejs are you using?

I had no problem running the first or the second command with your code:

npm install
solcjs --bin --include-path node_modules/ --base-path . test.sol

Or without including the node_modules:

solcjs --bin ./test.sol -o ./bin

My versions are:

node v18.8.0
solcjs 0.8.15+commit.e14f2714.Emscripten.clang

@reselbob
Copy link
Author

reselbob commented Sep 8, 2022

node --version
v16.17.0
solcjs --version
0.8.16+commit.07a7930e.Emscripten.clang

Let me revisit the issue, please. Thank you sincerely @r0qs to taking the time to help me out.

@cameel
Copy link
Member

cameel commented Sep 8, 2022

I also tried to reproduce and this does not happen for me. What platform are you on?

The crash apparently happens when the script tries to create the directory (. in this case):

solc-js/solc.ts

Line 225 in a0226f0

fs.mkdirSync(destination, { recursive: true });

It errors out because the directory exists but this is not supposed to happen because we use the recursive option. It could be a bug in node.js or the fs module - maybe there's something unusual on your filesystem (permissions?) - but whatever it is, the function is supposed to handle that.

@r0qs r0qs added the waiting for more input Issues waiting for more input by the reporter label Sep 26, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
waiting for more input Issues waiting for more input by the reporter
Projects
None yet
Development

No branches or pull requests

3 participants