Flattening on Windows and get error ENOENT: no such file or directory

I keep getting this error when i try to flatten. Any help would be appreciated

Error: ENOENT: no such file or directory, open ‘c:/Users/LENOVO/Desktop/THE%20GRIND/Blockchain%20Dev/gitrepo/MCNToken/node_modules/@openzeppelin/contracts/GSN/Context.sol’
at Object.openSync (fs.js:440:3)
at Object.readFileSync (fs.js:342:35)
at resolve (C:\Users\LENOVO\AppData\Roaming\npm\node_modules\truffle-flattener\index.js:23:27)
at async dependenciesDfs (C:\Users\LENOVO\AppData\Roaming\npm\node_modules\truffle-flattener\index.js:62:20)
at async dependenciesDfs (C:\Users\LENOVO\AppData\Roaming\npm\node_modules\truffle-flattener\index.js:73:7)
at async dependenciesDfs (C:\Users\LENOVO\AppData\Roaming\npm\node_modules\truffle-flattener\index.js:73:7)
at async getSortedFilePaths (C:\Users\LENOVO\AppData\Roaming\npm\node_modules\truffle-flattener\index.js:83:5)
at async flatten (C:\Users\LENOVO\AppData\Roaming\npm\node_modules\truffle-flattener\index.js:180:23)
at async main (C:\Users\LENOVO\AppData\Roaming\npm\node_modules\truffle-flattener\index.js:237:3) {
errno: -4058,
syscall: ‘open’,
code: ‘ENOENT’,
path: ‘c:/Users/LENOVO/Desktop/THE%20GRIND/Blockchain%20Dev/gitrepo/MCNToken/node_modules/@openzeppelin/contracts/GSN/Context.sol’
}

1 Like

Hi @Hendobox,

Welcome to the community :wave:

I am sorry that you are having issues flattening. I assume that you are trying to verify your token contract on Etherscan.

I recommend using Buidler Etherscan plugin to verify as a multifile contract: https://github.com/nomiclabs/buidler/tree/master/packages/buidler-etherscan

If you run into any issues you can post your contract, address and license being used in the forum and I can have a look.

I also suggest having a look at using Windows Subsystem for Linux (WSL) for developing smart contracts on Windows: Solidity Smart Contract development on Windows

Thanks for your response. Will try this out

1 Like

Hi @Hendobox,

Were you able to verify your contract?