Gulp: Gulp 3 is broken on Node 12

Created on 24 Apr 2019  路  6Comments  路  Source: gulpjs/gulp

What were you expecting to happen?

Gulp does anything useful

What actually happened?

Gulp throws the following error:

fs.js:27
const { Math, Object, Reflect } = primordials;
                                  ^

ReferenceError: primordials is not defined
    at fs.js:27:35
    at req_ (/tmp/node_modules/natives/index.js:143:24)
    at Object.req [as require] (/tmp/node_modules/natives/index.js:55:10)
    at Object.<anonymous> (/tmp/node_modules/gulp/node_modules/graceful-fs/fs.js:1:37)
    at Module._compile (internal/modules/cjs/loader.js:759:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:770:10)
    at Module.load (internal/modules/cjs/loader.js:628:32)
    at Function.Module._load (internal/modules/cjs/loader.js:555:12)
    at Module.require (internal/modules/cjs/loader.js:666:19)
    at require (internal/modules/cjs/helpers.js:16:16)

If using a TypeScript gulpfile with ts-node and typescript, the error looks like the following instead:

/tmp/node_modules/natives/index.js:143
    fn(internalBinding)(nm.exports, cachingRequire, nm, nm.filename, '<no dirname available>')
                       ^
ReferenceError: primordials is not defined
    at fs.js:27:35
    at req_ (/tmp/node_modules/natives/index.js:143:24)
    at Object.req [as require] (/tmp/node_modules/natives/index.js:55:10)
    at Object.<anonymous> (/tmp/node_modules/gulp/node_modules/graceful-fs/fs.js:1:37)
    at Module._compile (internal/modules/cjs/loader.js:759:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:770:10)
    at Module.load (internal/modules/cjs/loader.js:628:32)
    at Function.Module._load (internal/modules/cjs/loader.js:555:12)
    at Module.require (internal/modules/cjs/loader.js:666:19)
    at require (internal/modules/cjs/helpers.js:16:16)

Please post a sample of your gulpfile (preferably reduced to just the bit that's not working)

This reproduces with an empty gulpfile

What version of gulp are you using?

3.9.1

What versions of npm and node are you using?

npm: 6.9.0
node: 12.0.0

Most helpful comment

Gulp 3 is no longer supported.

All 6 comments

Gulp 3 is no longer supported.

Having the exact same problem. Using:

node: v12.1.0
npm: 6.9.0
gulp CLI version: 2.2.0
gulp Local version: 4.0.1

[exec] fs.js:27 [exec] const { Math, Object, Reflect } = primordials; [exec] ^ [exec] [exec] ReferenceError: primordials is not defined [exec] at fs.js:27:35 [exec] at req_ (/Users/remillet/dev/src/nuxeo/addons/nuxeo-platform-spreadsheet/nuxeo-platform-spreadsheet-web/src/main/js/node_modules/natives/index.js:143:24) [exec] at Object.req [as require] (/Users/remillet/dev/src/nuxeo/addons/nuxeo-platform-spreadsheet/nuxeo-platform-spreadsheet-web/src/main/js/node_modules/natives/index.js:55:10) [exec] at Object.<anonymous> (/Users/remillet/dev/src/nuxeo/addons/nuxeo-platform-spreadsheet/nuxeo-platform-spreadsheet-web/src/main/js/node_modules/graceful-fs/fs.js:1:37) [exec] at Module._compile (internal/modules/cjs/loader.js:759:30) [exec] at Object.Module._extensions..js (internal/modules/cjs/loader.js:770:10) [exec] at Module.load (internal/modules/cjs/loader.js:628:32) [exec] at Function.Module._load (internal/modules/cjs/loader.js:555:12) [exec] at Module.require (internal/modules/cjs/loader.js:666:19) [exec] at require (internal/modules/cjs/helpers.js:16:16)

@remillet one of the packages in your project is likely to be requiring gulp 3. If you inspect your package-lock.json which contains the list of installed packages, you should be able to sort it out.

Same issue

node: 12.1.0
npm: 6.9.0
gulp: 4.0.1

fs.js:27
const { Math, Object, Reflect } = primordials;
                                  ^
ReferenceError: primordials is not defined
at fs.js:27:35

I will reiterate what @phated said. Gulp 3 is no longer supported.

@JRetza if you are able to reproduce that error on gulp version 4+ you can open a new issue.

And to clarify even further, the natives module would only come from a VERY outdated version of graceful-fs that is not included in gulp 4 so it's going to be a different issue within your project (like an incorrect lockfile).

Was this page helpful?
0 / 5 - 0 ratings

Related issues

aaronroberson picture aaronroberson  路  4Comments

cgc picture cgc  路  3Comments

jonira picture jonira  路  3Comments

ssteinerx picture ssteinerx  路  3Comments

zellwk picture zellwk  路  3Comments