-1
Error: EACCES: permission denied, open '/Users/rishikesh/Library/Preferences/truffle-nodejs/config.json.tmp-4644209492910867'
    at openSync (node:fs:601:3)
    at attempt (/usr/local/lib/node_modules/truffle/build/webpack:/node_modules/atomically/dist/utils/retryify.js:33:1)
    at Object.writeFileSync (/usr/local/lib/node_modules/truffle/build/webpack:/node_modules/atomically/dist/index.js:136:1)
    at Conf._write (/usr/local/lib/node_modules/truffle/build/webpack:/packages/config/node_modules/conf/dist/source/index.js:375:1)
    at Conf.set store [as store] (/usr/local/lib/node_modules/truffle/build/webpack:/packages/config/node_modules/conf/dist/source/index.js:296:1)
    at Conf.set (/usr/local/lib/node_modules/truffle/build/webpack:/packages/config/node_modules/conf/dist/source/index.js:189:1)
    at /usr/local/lib/node_modules/truffle/build/webpack:/packages/dashboard/dist/lib/DashboardServer.js:76:1
    at Layer.handle [as handle_request] (/usr/local/lib/node_modules/truffle/build/webpack:/node_modules/express/lib/router/layer.js:95:1)
    at next (/usr/local/lib/node_modules/truffle/build/webpack:/node_modules/express/lib/router/route.js:137:1)
    at Route.dispatch (/usr/local/lib/node_modules/truffle/build/webpack:/node_modules/express/lib/router/route.js:112:1)
    at Layer.handle [as handle_request] (/usr/local/lib/node_modules/truffle/build/webpack:/node_modules/express/lib/router/layer.js:95:1)
    at /usr/local/lib/node_modules/truffle/build/webpack:/node_modules/express/lib/router/index.js:281:1
    at Function.process_params (/usr/local/lib/node_modules/truffle/build/webpack:/node_modules/express/lib/router/index.js:341:1)
    at next (/usr/local/lib/node_modules/truffle/build/webpack:/node_modules/express/lib/router/index.js:275:1)
    at /usr/local/lib/node_modules/truffle/build/webpack:/node_modules/express/node_modules/body-parser/lib/read.js:130:1
    at invokeCallback (/usr/local/lib/node_modules/truffle/build/webpack:/node_modules/express/node_modules/raw-body/index.js:224:1)
    at done (/usr/local/lib/node_modules/truffle/build/webpack:/node_modules/express/node_modules/raw-body/index.js:213:1)
    at IncomingMessage.onEnd (/usr/local/lib/node_modules/truffle/build/webpack:/node_modules/express/node_modules/raw-body/index.js:273:1)
    at IncomingMessage.emit (node:events:513:28)
    at endReadableNT (node:internal/streams/readable:1359:12)
    at processTicksAndRejections (node:internal/process/task_queues:82:21)

This is the first time i am using truffle and when i run the command truffle dashboard i got this error. here is my file link

Navitas28
  • 745
  • 4
  • 13

1 Answers1

0

I was having this problem with truffle. I know it may be a bit reckless but my solution was to change ownership of all files in the .config directory to my user. To accomplish this I did the following:

sudo chown myUsername:myUsername -R ~/.config

If you wanted to be a bit more careful about this you could alternatively run

sudo chown myUsername:myUsername ~/.config

sudo chown myUsername:myUsername ~/.config/truffle

sudo chown myUsername:myUsername ~/.config/truffle/config.json

After doing this I was able to run sudo npm i -g truffle. This was a quick fix to all the problems I had previously I hope it works for you!

alternatively once in my previous setup, similar problem occurred fixed it with

npm i -g --unsafe-perm=true --allow-root truffle

Navitas28
  • 745
  • 4
  • 13