question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

EACCES: permission denied, mkdir '/root/.config/hardhat-nodejs'

See original GitHub issue

I’m following the instructions in README.md, even so this problem persists.

First log [BUILDING AND RUNNING DOCKER]:

anarkrypto@anarkrypto-pc:~/lens-protocol/$ export USERID=$UID && docker-compose build && docker-compose run --name lens contracts-env bash
WARNING: The UID variable is not set. Defaulting to a blank string.
Building contracts-env
Sending build context to Docker daemon  4.391MB
Step 1/12 : FROM ethereum/solc:0.8.7 as build-deps
 ---> e0a6d5abb97a
Step 2/12 : FROM node:16 as build-packages
 ---> 5964aa70c11d
Step 3/12 : COPY package*.json ./
 ---> Using cache
 ---> 87b106f63cf5
Step 4/12 : COPY tsconfig*.json ./
 ---> Using cache
 ---> a30e3491931f
Step 5/12 : RUN npm ci --quiet
 ---> Using cache
 ---> 117a4d9b6ab8
Step 6/12 : FROM node:16
 ---> 5964aa70c11d
Step 7/12 : WORKDIR /src
 ---> Using cache
 ---> e4539717da4a
Step 8/12 : COPY --from=build-deps /usr/bin/solc /usr/bin/solc
 ---> Using cache
 ---> 5bc9c444c689
Step 9/12 : COPY --from=build-packages /node_modules /node_modules
 ---> Using cache
 ---> 542483875780
Step 10/12 : COPY docker-entrypoint.sh /docker-entrypoint.sh
 ---> Using cache
 ---> abcff19888cb
Step 11/12 : USER node
 ---> Using cache
 ---> bea0db6a71e8
Step 12/12 : ENTRYPOINT ["sh", "/docker-entrypoint.sh"]
 ---> Using cache
 ---> 5267e266e513
Successfully built 5267e266e513
Successfully tagged lens-protocol_contracts-env:latest
WARNING: The UID variable is not set. Defaulting to a blank string.
Creating network "lens-protocol_default" with the default driver
Creating lens-protocol_contracts-env_run ... done

“The UID variable is not set” Why ? Even with export USERID=$UID

  • If I run echo $USERID or echo $UID on host, I get 1000
  • If I run echo $USERID on container, I get nothing
  • If I run echo $UID on container, I get 0

Second Log [RUNNING TEST INSIDE CONTAINER]

root@1193996f0613:/src# npm run test

> lens-protocol@1.0.0 test
> npm run compile && TRACK_GAS=true hardhat test

glob error [Error: EACCES: permission denied, scandir '/root/.npm/_logs'] {
  errno: -13,
  code: 'EACCES',
  syscall: 'scandir',
  path: '/root/.npm/_logs'
}

> lens-protocol@1.0.0 compile
> SKIP_LOAD=true hardhat clean && SKIP_LOAD=true hardhat compile

An unexpected error occurred:

Error: EACCES: permission denied, mkdir '/root/.config/hardhat-nodejs'
    at Object.mkdirSync (node:fs:1334:3)
    at Object.mkdirsSync (/src/node_modules/fs-extra/lib/mkdirs/mkdirs-sync.js:31:9)
    at getConfigDirSync (/src/node_modules/hardhat/src/internal/util/global-dir.ts:21:6)
    at Object.hasConsentedTelemetry (/src/node_modules/hardhat/src/internal/util/global-dir.ts:103:21)
    at main (/src/node_modules/hardhat/src/internal/cli/cli.ts:136:49) {
  errno: -13,
  syscall: 'mkdir',
  code: 'EACCES',
  path: '/root/.config/hardhat-nodejs'
}
npm notice 
npm notice New minor version of npm available! 8.1.0 -> 8.6.0
npm notice Changelog: https://github.com/npm/cli/releases/tag/v8.6.0
npm notice Run npm install -g npm@8.6.0 to update!
npm notice 
root@1193996f0613:/src# exit
exit
ERROR: 1

“EACCES: permission denied, mkdir ‘/root/.config/hardhat-nodejs’”

This is weird considering the container user is root


Docker version 20.10.10, build b485636 Ubuntu 20.04.3 LTS

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:7 (1 by maintainers)

github_iconTop GitHub Comments

5reactions
dabit3commented, May 20, 2022

This worked for me:

export USERID=1000 && docker-compose build && docker-compose run --name lens contracts-env bash
0reactions
LintonAchmadcommented, Oct 13, 2022

I know this is closed but I can suggest that known workarounds to getting started/setup be posted in dev docs - I was stuck trying to get up and running 😃 - thanks fam.

Read more comments on GitHub >

github_iconTop Results From Across the Web

node.js - Error: EACCES: permission denied; cannot mkdir
Since you are in Ubunutu, try to make yourself as a root user first i.e sudo -i. Then install your hardhat package and...
Read more >
Issues - GitHub
EACCES : permission denied, mkdir '/root/.config/hardhat-nodejs' #104 ... root@1193996f0613:/src# npm run test > lens-protocol@1.0.0 test ...
Read more >
Resolving EACCES permissions errors when installing ...
This is the best way to avoid permissions issues. To reinstall npm with a node version manager, follow the steps in "Downloading and...
Read more >
How to fix ( Error: EACCES: permission denied, mkdir )
This command fixed the issue. It worked like a charm and installed all gulp packages without any directory permission errors.
Read more >
Node.js — npm ERR! Error: EACCES: permission denied ...
I cannot install a semantic-ui using npm. When I encounter an error like this usually the solution is using a sudo command. Please...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found