1

When i enter this command: sudo npm install -g truffle

I get the following error:


> truffle@5.0.27 postinstall /usr/lib/node_modules/truffle
> node ./scripts/postinstall.js

Error: EACCES: permission denied, open '/home/nslabiitp/.config/truffle/config.json'
You don't have access to this file.

    at Object.openSync (fs.js:443:3)
    at Object.readFileSync (fs.js:343:35)
    at Configstore.get all [as all] (/usr/lib/node_modules/truffle/build/webpack:/~/configstore/index.js:31:1)
    at new Configstore (/usr/lib/node_modules/truffle/build/webpack:/~/configstore/index.js:25:31)
    at Function.Config.getUserConfig (/usr/lib/node_modules/truffle/build/webpack:/packages/truffle-config/index.js:395:1)
    at Object.<anonymous> (/usr/lib/node_modules/truffle/build/webpack:/packages/truffle-core/lib/mnemonics/mnemonic.js:11:1)
    at __webpack_require__ (/usr/lib/node_modules/truffle/build/webpack:/webpack/bootstrap fa1fcd3fc6c4fef3eaf9:19:1)
    at Object.command.command (/usr/lib/node_modules/truffle/build/webpack:/packages/truffle-core/lib/commands/develop.js:2:22)
    at __webpack_require__ (/usr/lib/node_modules/truffle/build/webpack:/webpack/bootstrap fa1fcd3fc6c4fef3eaf9:19:1)
    at Object.module.exports.$schema (/usr/lib/node_modules/truffle/build/webpack:/packages/truffle-core/lib/commands/index.js:9:12)
    at __webpack_require__ (/usr/lib/node_modules/truffle/build/webpack:/webpack/bootstrap fa1fcd3fc6c4fef3eaf9:19:1)
    at Object.<anonymous> (/usr/lib/node_modules/truffle/build/webpack:/packages/truffle-core/cli.js:33:29)
    at __webpack_require__ (/usr/lib/node_modules/truffle/build/webpack:/webpack/bootstrap fa1fcd3fc6c4fef3eaf9:19:1)
    at /usr/lib/node_modules/truffle/build/webpack:/webpack/bootstrap fa1fcd3fc6c4fef3eaf9:65:1
    at Object.<anonymous> (/usr/lib/node_modules/truffle/build/cli.bundled.js:71:10)
    at Module._compile (internal/modules/cjs/loader.js:776:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
    at Function.Module._load (internal/modules/cjs/loader.js:585:3)
    at Function.Module.runMain (internal/modules/cjs/loader.js:829:12)
    at startup (internal/bootstrap/node.js:283:19)
Error: Error while attempting to download and cache solc 0.5.8: Command failed: node ./build/cli.bundled.js obtain --solc=0.5.8
Error: EACCES: permission denied, open '/home/nslabiitp/.config/truffle/config.json'
You don't have access to this file.

    at Object.openSync (fs.js:443:3)
    at Object.readFileSync (fs.js:343:35)
    at Configstore.get all [as all] (/usr/lib/node_modules/truffle/build/webpack:/~/configstore/index.js:31:1)
    at new Configstore (/usr/lib/node_modules/truffle/build/webpack:/~/configstore/index.js:25:31)
    at Function.Config.getUserConfig (/usr/lib/node_modules/truffle/build/webpack:/packages/truffle-config/index.js:395:1)
    at Object.<anonymous> (/usr/lib/node_modules/truffle/build/webpack:/packages/truffle-core/lib/mnemonics/mnemonic.js:11:1)
    at __webpack_require__ (/usr/lib/node_modules/truffle/build/webpack:/webpack/bootstrap fa1fcd3fc6c4fef3eaf9:19:1)
    at Object.command.command (/usr/lib/node_modules/truffle/build/webpack:/packages/truffle-core/lib/commands/develop.js:2:22)
    at __webpack_require__ (/usr/lib/node_modules/truffle/build/webpack:/webpack/bootstrap fa1fcd3fc6c4fef3eaf9:19:1)
    at Object.module.exports.$schema (/usr/lib/node_modules/truffle/build/webpack:/packages/truffle-core/lib/commands/index.js:9:12)
    at __webpack_require__ (/usr/lib/node_modules/truffle/build/webpack:/webpack/bootstrap fa1fcd3fc6c4fef3eaf9:19:1)
    at Object.<anonymous> (/usr/lib/node_modules/truffle/build/webpack:/packages/truffle-core/cli.js:33:29)
    at __webpack_require__ (/usr/lib/node_modules/truffle/build/webpack:/webpack/bootstrap fa1fcd3fc6c4fef3eaf9:19:1)
    at /usr/lib/node_modules/truffle/build/webpack:/webpack/bootstrap fa1fcd3fc6c4fef3eaf9:65:1
    at Object.<anonymous> (/usr/lib/node_modules/truffle/build/cli.bundled.js:71:10)
    at Module._compile (internal/modules/cjs/loader.js:776:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
    at Function.Module._load (internal/modules/cjs/loader.js:585:3)
    at Function.Module.runMain (internal/modules/cjs/loader.js:829:12)
    at startup (internal/bootstrap/node.js:283:19)

    at postinstallObtain (/usr/lib/node_modules/truffle/scripts/postinstall.js:13:11)
    at Object.<anonymous> (/usr/lib/node_modules/truffle/scripts/postinstall.js:20:3)
    at Module._compile (internal/modules/cjs/loader.js:776:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
    at Function.Module._load (internal/modules/cjs/loader.js:585:3)
    at Function.Module.runMain (internal/modules/cjs/loader.js:829:12)
    at startup (internal/bootstrap/node.js:283:19)
    at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3)
+ truffle@5.0.27
updated 1 package in 40.63s

I am unsure of what i am doing wrong and will appreciate pointers

closed as off-topic by Ismael, shane, alberto, Achala Dissanayake, Crissi Mariam Robert Jul 24 at 12:36

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "This question does not appear to be about Ethereum, the decentralized application platform and smart contract enabled blockchain, within the scope defined in the help center." – Ismael, shane, alberto, Achala Dissanayake, Crissi Mariam Robert
If this question can be reworded to fit the rules in the help center, please edit the question.

2

Fix for me was upgrade to node v12.6 Error: EACCES: permission denied, open '/root/.config/truffle/config.json'

I did try several fixes, hence the solution above might not be your case, however it is important that you test at least with a version higher than node v10, as there have been other issues on this version mentioned in the github webpage.

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