gulp Package task -ReferenceError: primordials is not defined
Asked Answered
S

3

8

Team,

My Ci Pipeline azure getting failed find error below. I have tried solution from How to fix ReferenceError: primordials is not defined in node but no luck

Error below :

##[section]Starting: gulp Package-Generate
==============================================================================
Task         : Gulp
Description  : Node.js streaming task based build system
Version      : 0.141.2
Author       : Microsoft Corporation
Help         : [More Information](https://go.microsoft.com/fwlink/?LinkID=613721)
==============================================================================
[command]C:\npm\prefix\gulp.cmd Package-Generate --gulpfile d:\a\1\s\gulpfile.js --configuration release
fs.js:27
const { Math, Object } = primordials;
                         ^

ReferenceError: primordials is not defined
    at fs.js:27:26
    at req_ (d:\a\1\s\node_modules\natives\index.js:143:24)
    at Object.req [as require] (d:\a\1\s\node_modules\natives\index.js:55:10)
    at Object.<anonymous> (d:\a\1\s\node_modules\graceful-fs\fs.js:1:37)
    at Module._compile (internal/modules/cjs/loader.js:956:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:973:10)
    at Module.load (internal/modules/cjs/loader.js:812:32)
    at Function.Module._load (internal/modules/cjs/loader.js:724:14)
    at Module.require (internal/modules/cjs/loader.js:849:19)
    at require (internal/modules/cjs/helpers.js:74:18)
##[error]Gulp failed with error: C:\npm\prefix\gulp.cmd failed with return code: 1
##[section]Finishing: gulp Package-Generate
Senzer answered 14/11, 2019 at 12:3 Comment(2)
Does this answer your question? How to fix ReferenceError: primordials is not defined in nodeParasitology
@Parasitology : it was fixed by architect ,so not sure about the solution.Senzer
A
14

I was getting this error while I was using Gulp 3.9.1 and NodeJS 12.14.0.

I have solved uninstalling NodeJS 12.14.0 and installing NodeJS 10.13.0 version.

Then everything worked properly.

Amanuensis answered 23/12, 2019 at 16:11 Comment(0)
M
3

I fixed this by using the Node.js tool installer and targeted node version 10x. Make this your first task. This made it so I didn't have to upgrade gulp to 4. I'm building on ubuntu-16.04

build pipeline

Montoya answered 19/12, 2019 at 5:46 Comment(0)
H
2

If you are using Microsoft hosted agents, the version of nodejs is automatically updated to the latest LTS.

So now you have to update your build to use Gulp 4. I found this blog helpful for the migration.

Hinshaw answered 21/11, 2019 at 8:45 Comment(0)

© 2022 - 2025 — McMap. All rights reserved.