tagomaru / truffle-sca2t

Smart contract auditing assistant tool for Truffle Framework.
18 stars 4 forks source link

Error: Cannot find module 'truffle-sca2t-mythx' #27

Closed muellerberndt closed 5 years ago

muellerberndt commented 5 years ago

After following the README instructions I end up getting an error during npm run test:security:

$ npm run test:security

> truffle-example-project@1.0.0 test:security /Users/bernhardmueller/Desktop/MythX-Testing/truffle-example-project
> mocha ./test_security --timeout 500000

internal/modules/cjs/loader.js:670
    throw err;
    ^

Error: Cannot find module 'truffle-sca2t-mythx'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:668:15)
    at Function.Module._load (internal/modules/cjs/loader.js:591:27)
    at Module.require (internal/modules/cjs/loader.js:723:19)
    at require (internal/modules/cjs/helpers.js:14:16)
    at Object.<anonymous> (/Users/bernhardmueller/Desktop/MythX-Testing/truffle-example-project/test_security/test_Etherbank.sol_.js:2:16)
    at Module._compile (internal/modules/cjs/loader.js:816:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:827:10)
    at Module.load (internal/modules/cjs/loader.js:685:32)
    at Function.Module._load (internal/modules/cjs/loader.js:620:12)
    at Module.require (internal/modules/cjs/loader.js:723:19)
    at require (internal/modules/cjs/helpers.js:14:16)
    at /usr/local/lib/node_modules/mocha/lib/mocha.js:250:27
    at Array.forEach (<anonymous>)
    at Mocha.loadFiles (/usr/local/lib/node_modules/mocha/lib/mocha.js:247:14)
    at Mocha.run (/usr/local/lib/node_modules/mocha/lib/mocha.js:576:10)
    at Object.<anonymous> (/usr/local/lib/node_modules/mocha/bin/_mocha:637:18)
    at Module._compile (internal/modules/cjs/loader.js:816:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:827:10)
    at Module.load (internal/modules/cjs/loader.js:685:32)
    at Function.Module._load (internal/modules/cjs/loader.js:620:12)
    at Function.Module.runMain (internal/modules/cjs/loader.js:877:12)
    at internal/main/run_main_module.js:21:11
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! truffle-example-project@1.0.0 test:security: `mocha ./test_security --timeout 500000`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the truffle-example-project@1.0.0 test:security script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm WARN Local package.json exists, but node_modules missing, did you mean to install?

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/bernhardmueller/.npm/_logs/2019-04-26T12_37_51_764Z-debug.log
cerebral-cortex:truffle-example-project bernhardmueller$ npm install -g truffle-sca2t-mythx
npm WARN deprecated coffee-script@1.12.7: CoffeeScript on NPM has moved to "coffeescript" (no hyphen)
npm WARN deprecated tar.gz@1.0.7: ⚠️  WARNING ⚠️ tar.gz module has been deprecated and your application is vulnerable. Please use tar module instead: https://npmjs.com/tar
npm WARN deprecated fs-promise@2.0.3: Use mz or fs-extra^3.0 with Promise Support
+ truffle-sca2t-mythx@0.5.0
added 58 packages from 99 contributors, removed 4 packages, updated 7 packages and moved 2 packages in 16.621s
cerebral-cortex:truffle-example-project bernhardmueller$ npm run test:security

> truffle-example-project@1.0.0 test:security /Users/bernhardmueller/Desktop/MythX-Testing/truffle-example-project
> mocha ./test_security --timeout 500000

internal/modules/cjs/loader.js:670
    throw err;
    ^

Error: Cannot find module 'truffle-sca2t-mythx'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:668:15)
    at Function.Module._load (internal/modules/cjs/loader.js:591:27)
    at Module.require (internal/modules/cjs/loader.js:723:19)
    at require (internal/modules/cjs/helpers.js:14:16)
    at Object.<anonymous> (/Users/bernhardmueller/Desktop/MythX-Testing/truffle-example-project/test_security/test_Etherbank.sol_.js:2:16)
    at Module._compile (internal/modules/cjs/loader.js:816:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:827:10)
    at Module.load (internal/modules/cjs/loader.js:685:32)
    at Function.Module._load (internal/modules/cjs/loader.js:620:12)
    at Module.require (internal/modules/cjs/loader.js:723:19)
    at require (internal/modules/cjs/helpers.js:14:16)
    at /usr/local/lib/node_modules/mocha/lib/mocha.js:250:27
    at Array.forEach (<anonymous>)
    at Mocha.loadFiles (/usr/local/lib/node_modules/mocha/lib/mocha.js:247:14)
    at Mocha.run (/usr/local/lib/node_modules/mocha/lib/mocha.js:576:10)
    at Object.<anonymous> (/usr/local/lib/node_modules/mocha/bin/_mocha:637:18)
    at Module._compile (internal/modules/cjs/loader.js:816:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:827:10)
    at Module.load (internal/modules/cjs/loader.js:685:32)
    at Function.Module._load (internal/modules/cjs/loader.js:620:12)
    at Function.Module.runMain (internal/modules/cjs/loader.js:877:12)
    at internal/main/run_main_module.js:21:11
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! truffle-example-project@1.0.0 test:security: `mocha ./test_security --timeout 500000`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the truffle-example-project@1.0.0 test:security script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm WARN Local package.json exists, but node_modules missing, did you mean to install?

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/bernhardmueller/.npm/_logs/2019-04-26T12_38_25_842Z-debug.log

Installing truffle-sca2t and truffle-sca2t-mythx globally does not fix the issue. I ran both:

$ npm install -g truffle-sca2t-mythx
$ npm install -g truffle-sca2t
muellerberndt commented 5 years ago

Update: The issue is fixed by installing truffle-sca2t locally in the project directory, but it doesn't seem to work when truffle-sca2t is installed globally only.

tagomaru commented 5 years ago

@b-mueller Many thanks for your raising this up!

I guess:

the test code file cannot find truffle-sca2t-mythx since truffle-sca2t-mythx is nested in truffle-sca2t if truffle-sca2t is installed globally.

On the other hand, if truffle-sca2t is installed locally, truffle-sca2t-mythx is also installed directly under node_modules.

I will update README and improve this at a later date.

Anyway, thx!

tagomaru commented 5 years ago

I updated README to prevent global install.

https://github.com/tagomaru/truffle-sca2t#getting-started https://www.npmjs.com/package/truffle-sca2t#getting-started

tagomaru commented 5 years ago

Hi @b-mueller

Please try v0.5.2.

If you want to install it globally, you may need to install it with mocha and mocha-simple-html-reporter. https://github.com/tagomaru/truffle-sca2t#getting-started

muellerberndt commented 5 years ago

Seems fine, I think we can close this issue?

tagomaru commented 5 years ago

Thx @b-mueller ! I am going to close this.