I got error when try to install solc using

npm install -g solc

here is the error:

erfans-MacBook-Pro:01 erfanandesta$ npm uninstall -g solc
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/solc
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules/solc/node_modules
npm ERR! path /usr/local/lib/node_modules/solc
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall access
npm ERR! Error: EACCES: permission denied, access '/usr/local/lib/node_modules/solc'
npm ERR!  { [Error: EACCES: permission denied, access '/usr/local/lib/node_modules/solc']
npm ERR!   stack:
npm ERR!    "Error: EACCES: permission denied, access '/usr/local/lib/node_modules/solc'",
npm ERR!   errno: -13,
npm ERR!   code: 'EACCES',
npm ERR!   syscall: 'access',
npm ERR!   path: '/usr/local/lib/node_modules/solc' }
npm ERR! 
npm ERR! The operation was rejected by your operating system.
npm ERR! It is likely you do not have the permissions to access this file as the current user
npm ERR! 
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator (though this is not recommended).

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/erfanandesta/.npm/_logs/2018-12-06T07_44_32_823Z-debug.log

when i use sudo npm install -g solc it install successfully i now i got this error :

    throw err;

Error: Cannot find module './smtchecker.js'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:603:15)
    at Function.Module._load (internal/modules/cjs/loader.js:529:25)
    at Module.require (internal/modules/cjs/loader.js:658:17)
    at require (internal/modules/cjs/helpers.js:22:18)
    at Object.<anonymous> (/usr/local/lib/node_modules/solc/solcjs:9:18)
    at Module._compile (internal/modules/cjs/loader.js:722:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:733:10)
    at Module.load (internal/modules/cjs/loader.js:620:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:560:12)
    at Function.Module._load (internal/modules/cjs/loader.js:552:3)

This is not a solc related error. Use below command instead:

sudo npm install -g solc

You need to provide sufficient permissions as you are installing it globally.

EDIT1: Regarding the smtchecker error, it seems it is missing this file : https://github.com/ethereum/solc-js/blob/master/smtchecker.js

Put it in the right place in your solcjs package folder and it should be working.

Although this is a workaround not a regular solution because this seems a problem with solc. I have raised the issue regarding this, which can be followed here: https://github.com/ethereum/solc-js/issues/324

| improve this answer | |
  • i update my question – andesta.erfan Dec 6 '18 at 8:04
  • That is a different question which looks related to your project structure. Should be asked separately. – Aniket Dec 6 '18 at 8:08
  • I think it's not about my project because I dont have any yet.if you know the answer update it – andesta.erfan Dec 6 '18 at 8:10
  • Does this error appear while installing solc? – Aniket Dec 6 '18 at 8:13
  • 1
    I can also confirm that after I copy and pasted the file from GitHub it worked. However, this is not normal. Is there a problem with the solc repo? – Paul Razvan Berg Dec 17 '18 at 23:11

Not the answer you're looking for? Browse other questions tagged or ask your own question.