Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

@babel/register write cache fail in node:alpine docker container #11130

cncolder opened this issue Feb 12, 2020 · 3 comments

@babel/register write cache fail in node:alpine docker container #11130

cncolder opened this issue Feb 12, 2020 · 3 comments


Copy link

@cncolder cncolder commented Feb 12, 2020

Bug Report

  • I would like to work on a fix!

Current Behavior
In node:alpine docker image. The folder node_modules create by root. And node server runs by 'node' user. So node_modules isn't writeable.

cache.js not handle ENOENT error. It just throw out and crash node server.

        throw e;

Error: ENOENT: no such file or directory, mkdir '/home/node/app/node_modules/.cache/@babel/register'
    at Object.mkdirSync (fs.js:856:3)
    at module.exports.sync (/home/node/app/node_modules/make-dir/index.js:97:6)
    at save (/home/node/app/node_modules/@babel/register/lib/cache.js:61:23)
    at processTicksAndRejections (internal/process/task_queues.js:79:11) {
  errno: -2,
  syscall: 'mkdir',
  code: 'ENOENT',
  path: '/home/node/app/node_modules/.cache/@babel/register'

Input Code

  • REPL or Repo link if applicable:
var your => (code) => here;

Expected behavior/code
A clear and concise description of what you expected to happen (or code).

Babel Configuration (babel.config.js, .babelrc, package.json#babel, cli command, .eslintrc)

  • Filename: babel.config.js
  "your": { "config": "here" }


  • Babel version(s): v7.8.3
  • Node/npm version: Node v13.8.0/npm 6.13.6
  • OS: Alpine Linux
  • Monorepo: no
  • How you are using Babel: register

Possible Solution

Additional context/Screenshots
Add any other context about the problem here. If applicable, add screenshots to help explain.


This comment has been minimized.

Copy link

@babel-bot babel-bot commented Feb 12, 2020

Hey @cncolder! We really appreciate you taking the time to report an issue. The collaborators on this project attempt to help as many people as possible, but we're a limited number of volunteers, so it's possible this won't be addressed swiftly.

If you need any help, or just have general Babel or JavaScript questions, we have a vibrant Slack community that typically always has someone willing to help. You can sign-up here for an invite."


This comment has been minimized.

Copy link

@JLHwung JLHwung commented Feb 12, 2020

As a workaround, you can disable the register cache via BABEL_DISABLE_CACHE env


If node_modules is not writable due to permission errors, it should throw EACCESS instead of ENOENT. Babel will ignore the EACCESS error and produce warnings only.


ENOENT: No such file or directory (POSIX.1-2001).
Typically, this error results when a specified path‐name does not exist, or one of the components in the directory prefix of a pathname does not exist, or the specified pathname is a dangling symbolic link.

In your case, maybe /home/node/app/node_modules is a dangling symbolic link mounted by Docker. @cncolder Can you share the reproducing Dockerfile?


This comment has been minimized.

Copy link

@cncolder cncolder commented Feb 16, 2020

@JLHwung @babel/register use find-cache-dir@2. It's not check folder permission.

// v2 return '/home/node/app/node_modules/.cache/@babel/register'
// v3 return undefined
findCacheDir({ name: "@babel/register" })

findCacheDir({ name: "@babel/register" }) || os.homedir() || os.tmpdir();

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
3 participants
You can’t perform that action at this time.