Skip to content

@babel/register crashes when node_modules/.cache folder is not writable #6906

@feross

Description

@feross

Bug report.

@babel/register crashes when the node_modules/.cache folder is not writable. This can happen if the node process is running as a different user than the user who owns the node_modules folder.

Babel Register Configuration

The specifics of my config are not relevant to this issue, but here it is anyway.

babelRegister({
  only: [/views/, /lib/],
  extensions: ['.js', '.mjs']
})

Expected Behavior

I noticed that @std/esm also uses the node_modules/.cache folder, but it recovers gracefully when this folder is not writable, probably falling back to another folder or simply disabling the cache. This seems like much better behavior than crashing the process.

Current Behavior

The process crashes when node_modules/.cache is not writable.

Context

I run my production Node.js process as the www-data user, which does not have permission to write to the app folder, including the node_modules folder. Therefore, @babel/register is unable to write into the node_modules/.cache folder.

Your Environment

software version(s)
Babel @babel/core@7.0.0-beta.32
Babel-register @babel/register@7.0.0-beta.32
Babylon
node 8.9.0
npm 5.5.1
Operating System macOS 10.13.1

Metadata

Metadata

Assignees

No one assigned

    Labels

    Has PRoutdatedA closed issue/PR that is archived due to age. Recommended to make a new issuepkg: register

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions