0

Installed Node version 12.13.0 on windows 10. All npm commands throws the following error:

   C:\Users\Jahangeer> npm -v
   evalmachine.<anonymous>:27
   const { Math, Object } = primordials;
                     ^

   ReferenceError: primordials is not defined
       at evalmachine.<anonymous>:27:26
       at Object.<anonymous> 
   (C:\Users\Jahangeer\AppData\Roaming\npm\node_modules\npm\node_modules\graceful-fs\fs.js:11:1)
       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)
       at Object.<anonymous> 
   (C:\Users\Jahangeer\AppData\Roaming\npm\node_modules\npm\node_modules\graceful-fs\graceful- 
   fs.js:3:27)
       at Module._compile (internal/modules/cjs/loader.js:956:30)

Tried uninstalling and installing few other older Node versions. The Problem remains.

1 Answers1

0

Use these commands to install node 11 and gulp 3 and check:

npm install -g n

sudo n 11.15.0

npm install gulp@^3.9.1 npm install npm rebuild node-sass

Himanshu
  • 835
  • 1
  • 13
  • 22
  • Is npm added to your path in environment variables??. Please check and add if not added. – Himanshu Nov 06 '19 at 03:18
  • " C:\Users\Jahangeer\AppData\Roaming\npm " was already in the 'path' environment variable. After googling i added the following path also " C:\Program Files\nodejs\node_modules\npm\bin ". Neither of them could'nt solve the problem. @Himanshu – AjithKumar Nov 06 '19 at 06:24
  • Add C:\Program Files\nodejs\ in Path under System Variables under Environment variables and check. – Himanshu Nov 06 '19 at 07:16
  • Tried adding ' c:\Program Files\nodejs\ ' as the only npm reference in the path variable, still same error shows. – AjithKumar Nov 06 '19 at 07:56
  • I think c in the path should be Capital "C:\Program Files\nodejs\". Add them under system variables in Path variable and check. – Himanshu Nov 06 '19 at 08:39
  • Typo here in the comment bro, path variable has correct path. – AjithKumar Nov 06 '19 at 15:25
  • Check if this is the root cause of your error. https://dev.to/only8britt/referenceerror-primordials-is-not-defined-140a – Ramachandra A Pai Nov 09 '19 at 05:31
  • Thanks for the reply @RamachandraAPai. The solution provided in the website is for a project(older). My problem is not with a project, but with the NPM itself, since none of the NPM related commands are working in my system. – AjithKumar Nov 09 '19 at 05:48