solpp icon indicating copy to clipboard operation
solpp copied to clipboard

Odd "MODULE_NOT_FOUND" out of nowhere

Open deluca-mike opened this issue 3 years ago • 2 comments

slopp was working perfectly fine, then just did a reinstall/upgrade of another unrelated package with yarn, and now this:

$ yarn precompile
yarn run v1.22.10

$ solpp --no-flatten --defs configs/definitions.json --output eth/contracts/library.sol eth/pre-contracts/library.sol
internal/modules/cjs/loader.js:883
  throw err;
  ^

Error: Cannot find module 'antlr4/index'
Require stack:
- /Users/MY_USERNAME/Projects/MY_PROJECT/node_modules/solpp/src/antlr/SolLexer.js
- /Users/MY_USERNAME/Projects/MY_PROJECT/node_modules/solpp/src/oven.js
- /Users/MY_USERNAME/Projects/MY_PROJECT/node_modules/solpp/src/index.js
- /Users/MY_USERNAME/Projects/MY_PROJECT/node_modules/solpp/src/solpp.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:880:15)
    at Function.Module._load (internal/modules/cjs/loader.js:725:27)
    at Module.require (internal/modules/cjs/loader.js:952:19)
    at require (internal/modules/cjs/helpers.js:88:18)
    at Object.<anonymous> (/Users/MY_USERNAME/Projects/MY_PROJECT/node_modules/solpp/src/antlr/SolLexer.js:3:14)
    at Module._compile (internal/modules/cjs/loader.js:1063:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
    at Module.load (internal/modules/cjs/loader.js:928:32)
    at Function.Module._load (internal/modules/cjs/loader.js:769:14)
    at Module.require (internal/modules/cjs/loader.js:952:19) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/Users/MY_USERNAME/Projects/MY_PROJECT/node_modules/solpp/src/antlr/SolLexer.js',
    '/Users/MY_USERNAME/Projects/MY_PROJECT/node_modules/solpp/src/oven.js',
    '/Users/MY_USERNAME/Projects/MY_PROJECT/node_modules/solpp/src/index.js',
    '/Users/MY_USERNAME/Projects/MY_PROJECT/node_modules/solpp/src/solpp.js'
  ]
}

Using node 14.15.1

deluca-mike avatar Dec 08 '20 08:12 deluca-mike

npm install does seem to fix this. yarn install breaks it.

Despite solpp 0.11.2 specifying antlr4: ^4.7.1 yarn is pulling [email protected] which seems to have made changes that break solpp (in how it was being imported).

~~Will try upgrading yarn.~~

Confirmed. Installing solpp with yarn is busted. Use npm.

deluca-mike avatar Dec 08 '20 08:12 deluca-mike

Thanks for flagging this. I pinned the version of antlr4 to ~4.8.0. Should be fixed in 0.11.3!

dorothy-zbornak avatar Dec 17 '20 06:12 dorothy-zbornak