Skip to content

fs.promises is undefined #69

@MartinKavik

Description

@MartinKavik

Hi,

fs.promises is undefined on some platforms (at least on NixOS). I wasn't able to track down exact problem, but it seems that webpack is doing some magic with fs.
And I think we shouldn't use APIs which are flagged as experimental in Node.js LTS version (like fs.promises) because they can (indirectly) cause problems.

I suggest to replace

return fs.promises.stat(this.crateDirectory).then(stats => {

with

const stat = util.promisify(fs.stat);
...
return stat(this.crateDirectory).then(stats => {

I'll create PR.


Platform details:

  • node v10.15.3
  • npm 6.4.1
  • yarn 1.13.0
  • nixos 19.03

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions