Skip to content

Fixing "ReferenceError: primordials is not defined" when running older NW.js

The Jared Wilcurt edited this page Jun 21, 2021 · 4 revisions

Older versions of NW.js used graceful-fs <4.2, which would mutate the Node file system (fs). After Node 11, this was no longer possible. So if you try to npm install nw@0.12.3 for example, using a version of Node >11, then you will get an error (primordials is not defined). To fix this:

  1. Create a file next to package.json called npm-shrinkwrap.json
  2. Put this in the file:
{
  "dependencies": {
    "graceful-fs": {
        "version": "4.2.2"
     }
  }
}
  1. Delete node_modules folder
  2. Run npm install
  3. git add -A
  4. git commit -m "Add compatibility to newer Node.js version"
Clone this wiki locally