ReferenceError: primordials is not defined in index.js + EBADPLATFORM

2,678 views
Skip to first unread message

Navaneetha Krishnan S

unread,
Feb 1, 2020, 1:38:02 PM2/1/20
to Angular and AngularJS discussion

I'm getting this error primordials is not defined when I try to compile my angular application.

> gulp && rimraf dist
fs.js:27
const { Math, Object } = primordials;
                         ^

ReferenceError: primordials is not defined
    at fs.js:27:26
    at req_ (C:\..\node_modules\natives\index.js:143:24)
    at Object.req [as require] (C:\..\node_modules\natives\index.js:55:10)
    at Object.<anonymous> (C:\..\node_modules\vinyl-fs\node_modules\graceful-fs\fs.js:1:37)
    at Module._compile (internal/modules/cjs/loader.js:955:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:991:10)
    at Module.load (internal/modules/cjs/loader.js:811:32)
    at Function.Module._load (internal/modules/cjs/loader.js:723:14)
    at Module.require (internal/modules/cjs/loader.js:848:19)
    at require (internal/modules/cjs/helpers.js:74:18)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! test.web@1.1.0 build:clean: `gulp && rimraf dist`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the test.web@1.1.0 build:clean script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\..\AppData\Roaming\npm-cache\_logs\2020-01-31T23_35_26_855Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1

My node version is : 6.13.4

Gulp version is : gu...@3.9.1

Angular Version of my application: "@angular/core": "6.1.10"


I tried the following steps:

  1. I uninstalled nodejs and reinstalled, removed node_modules and run

  2. "npm install" removed npm-cache and npm folders under C:\Users..\AppData\Roaming\

When I try to run npm install -g n I get this below error

npm ERR! code EBADPLATFORM
npm ERR! notsup Unsupported platform for n@6.2.0: wanted {"os":"!win32","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm ERR! notsup Valid OS:    !win32
npm ERR! notsup Valid Arch:  any
npm ERR! notsup Actual OS:   win32
npm ERR! notsup Actual Arch: x64

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\...\AppData\Roaming\npm-cache\_logs\2020-01-31T23_44_44_033Z-debug.log

Any ideas how to resolve this issue?

manish pamnani

unread,
Feb 4, 2020, 12:25:59 AM2/4/20
to Angular and AngularJS discussion
You might be using incompatible version. The SOlution is to Either upgrade to gulp 4 or downgrade to an earlier node.

Refer to below article for more info:

https://stackoverflow.com/questions/55921442/how-to-fix-referenceerror-primordials-is-not-defined-in-node

Hope it Helps.

Milan cubes

unread,
Jun 11, 2020, 1:09:15 AM6/11/20
to Angular and AngularJS discussion

Milan cubes

unread,
Jun 11, 2020, 1:09:15 AM6/11/20
to Angular and AngularJS discussion
you might refer this forum answer. i was solved this error here https://icetutor.com/question/referenceerror-primordials-is-not-defined-in-node-solved/


On Sunday, February 2, 2020 at 12:08:02 AM UTC+5:30, Navaneetha Krishnan S wrote:
Reply all
Reply to author
Forward
0 new messages