1

I know this question is posted many times but I tried the solutions and I can not resolve it. I am trying to work wit npm however I get this error:

     evalmachine.<anonymous>:35
    } = primordials;
        ^
    
    ReferenceError: primordials is not defined
        at evalmachine.<anonymous>:35:5
        at Object.<anonymous> (C:\Users\User\AppData\Roaming\npm\node_modules\npm\node_modules\graceful-fs\fs.js:11:8)
        at Module._compile (internal/modules/cjs/loader.js:1138:30)
        at Object.Module._extensions..js (internal/modules/cjs/loader.js:1158:10)
        at Module.load (internal/modules/cjs/loader.js:986:32)
        at Function.Module._load (internal/modules/cjs/loader.js:879:14)
        at Module.require (internal/modules/cjs/loader.js:1026:19)
        at require (internal/modules/cjs/helpers.js:72:18)
        at Object.<anonymous> (C:\Users\User\AppData\Roaming\npm\node_modules\npm\node_modules\graceful-fs\graceful-fs.js:3:27)
        at Module._compile (internal/modules/cjs/loader.js:1138:30)

I can not even execute npm -v to see the version. I tried to downgrade node to version 10. I tried to uninstall-reinstall node so many times (From remove application settings). I tried to create a file called "npm-shrinkwrap.json" insde the npm folder where package.json exists. But there is no use.

And I can't see an "AppData" folder in the "Users/User" path but I can access it by "cd" from the command line. I don't understand how it is not visible.

Thank you.

pigwidgeon
  • 190
  • 1
  • 2
  • 11

2 Answers2

2

It is resolved!

I know I said I uninstalled npm, but just uninstalling it from the settings were not enough. I tried to uninstall it deleting the node releted directories on my computer following this post: https://stackoverflow.com/a/11178106/13806114. And then I installed node again and it worked!

Thank you.

pigwidgeon
  • 190
  • 1
  • 2
  • 11
  • In my case these directories (C:\Users\..\npm and npm-cache) contained a lot of stuff and all files were pretty old 2015-2017 from a previous abandoned nodejs installation. The surprising thing is that after installing nodejs, running successfuly npm install - the file node_modules\npm\node_modules\graceful-fs\fs.js was not used at all, actually my directory C:\Users\..\npm is empty. That means the behavior of npm is condicionated by an old script structure which I think is very bad idea / design, at least very confusing as this error shows. – Alejadro Xalabarder Sep 17 '20 at 20:02
0

It's looking for the "primordials" method in graceful-fs, trying to reinstall this dependency.

About npm, try reinstalling nodejs again, probably your npm is corrupted

About AppData is not visible or is a hidden directory in Windows, you can access it by path in Windows Explorer

Henrique Viana
  • 645
  • 4
  • 12