Open fvictorio opened 4 years ago
Using version 0.4.11.
0.4.11
Reproduction steps: install the library and run:
const parser = require('solidity-parser-antlr') const tokens = parser.tokenize('contract Foo {}')
Throws this error:
Error: ENOENT: no such file or directory, open <root>/node_modules/solidity-parser-antlr/lib/Solidity.tokens'
I cloned the repo and made two modifications:
rm -rf dist && babel --out-dir=dist src --copy-files
--copy-files
src/tokens.js
diff --git a/src/tokens.js b/src/tokens.js index 10836dd..f47b0ac 100644 --- a/src/tokens.js +++ b/src/tokens.js @@ -55,7 +55,7 @@ function getTokenType(value) { } function getTokenTypeMap() { - const filePath = path.join(__dirname, '../lib/Solidity.tokens') + const filePath = path.join(__dirname, './lib/Solidity.tokens') return fs .readFileSync(filePath)
This worked for me, but I'm not sure if it may have another implications. If you want, I can create a PR with this change.
Using version
0.4.11
.Reproduction steps: install the library and run:
Throws this error:
Possible fix
I cloned the repo and made two modifications:
rm -rf dist && babel --out-dir=dist src --copy-files
(adds--copy-files
)src/tokens.js
, make this change:This worked for me, but I'm not sure if it may have another implications. If you want, I can create a PR with this change.