Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Problem with NPM and graceful-fs #2613

Closed
beke64 opened this issue Apr 17, 2020 · 15 comments
Closed

Problem with NPM and graceful-fs #2613

beke64 opened this issue Apr 17, 2020 · 15 comments

Comments

@beke64
Copy link

beke64 commented Apr 17, 2020

Hi all,
after installing Node.js v12.16.2 on Windows 10 in order to use the Ionic framework, I get the following error checking the npm version to test the environment.

C:\Users\xxxxxx>npm -v
evalmachine.:35
} = primordials;
^

ReferenceError: primordials is not defined
at evalmachine.:35:5
at Object. (C:\Users\beke\AppData\Roaming\npm\node_modules\npm\node_modules\graceful-fs\fs.js:11:1)
at Module._compile (internal/modules/cjs/loader.js:1156:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1176:10)
at Module.load (internal/modules/cjs/loader.js:1000:32)
at Function.Module._load (internal/modules/cjs/loader.js:899:14)
at Module.require (internal/modules/cjs/loader.js:1042:19)
at require (internal/modules/cjs/helpers.js:77:18)
at Object. (C:\Users\beke\AppData\Roaming\npm\node_modules\npm\node_modules\graceful-fs\graceful-fs.js:3:27)
at Module._compile (internal/modules/cjs/loader.js:1156:30)

I've established that the error I'm getting is not due to an older version of graceful-fs.

I've tried to unistall and re-install node.js 12.16.2, the last LTS version (two times, the first by msi installer downloaded from https://nodejs.org/it/download/ and the second by nvm).

Both the installation returned the same error.

I'v tried to check the effective version of graceful-fs existing on my hdd and opening the package.json file in the C:\Program Files\nodejs\node_modules\npm\node_modules\graceful-fs folder I found that the version is 4.2.3.

I've also tried to install via npm the last version of node.js (13.13.0) and the result is exactly the same: Graceful-fs 4.2.3 installed and the same error.

Can anyone help me to solve this problem, please?
Any idea?
Any other community to ask these question?

@bnoordhuis
Copy link
Member

I'm moving this to nodejs/help because it's not an issue with Node.js itself, although you're probably better off reporting it to npm.

Per my comment in nodejs/node#32799, I can tell from the error message that it's an old graceful-fs version. You can check for yourself by looking for that fs.js file - you won't find it in v4.2.3.

@bnoordhuis bnoordhuis transferred this issue from nodejs/node Apr 17, 2020
@beke64
Copy link
Author

beke64 commented Apr 17, 2020

I'm moving this to nodejs/help because it's not an issue with Node.js itself, although you're probably better off reporting it to npm.

Thanks.
Wherever you think it's the best place to resolve this issue.

Per my comment in #32799, I can tell from the error message that it's an old graceful-fs version. You can check for yourself by looking for that fs.js file - you won't find it in v4.2.3.

You are right.
These are the files I can see in the folder C:\Program Files\nodejs\node_modules\npm\node_modules\graceful-fs

  • clone.js
  • graceful-fs.js
  • legacy-streams.js
  • LICENSE
  • package.json
  • polyfills.js
  • README.md

So, why when I call npm -v npm look for an old graceful-fs file that do not exist anymore?

@bnoordhuis
Copy link
Member

That's what I mean when I said it's picking up an old version. Look at the paths you mention:

  • C:\Users\beke\AppData\Roaming\npm\node_modules\npm\node_modules\graceful-fs
  • C:\Program Files\nodejs\node_modules\npm\node_modules\graceful-fs

@beke64
Copy link
Author

beke64 commented Apr 17, 2020

I see.
in the folder C:\Users\beke\AppData\Roaming\npm\node_modules\npm\node_modules\graceful-fs there is an older version of graceful-js (3.0.6)
while in the folder C:\Program Files\nodejs\node_modules\npm\node_modules\graceful-fs there is the newer right version (4.2.3)
So... what's the point?
What should I do now?

@bnoordhuis
Copy link
Member

It's your system so it's up to you but I'd try removing the old npm install in C:\Users\beke\AppData\Roaming\npm.

@beke64
Copy link
Author

beke64 commented Apr 18, 2020

I have uninstalled node.js.
The "C:\Program Files\nodejs\ folder" no longer exists.
But in "C:\Users\beke\AppData\Roaming" there is still an "npm" folder (and, yes, it contains the old version of graceful-fs) and also an "npm-cache" folder.
Do you think that I can safely delete these folders?

@bnoordhuis
Copy link
Member

Probably. I don't see how it can hurt.

@beke64
Copy link
Author

beke64 commented Apr 19, 2020

All done.
Everything works fine now.
For anyone running into this mistake:

  • Uninstall node.js
  • Delete C:\Users\username\AppData\Roaming\npm folder
  • Delete C:\Users\username\AppData\Roaming\npm-cache folder
  • Reinstall node.js

@saritvakrat
Copy link

Hi,
I also get this when I try to run one of nodes internal files

ReferenceError: primordials is not defined
    at Object.<anonymous> (/Users/sarit/Documents/code/node/lib/internal/util/comparisons.js:23:5)
    at Module._compile (internal/modules/cjs/loader.js:959:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:995:10)
    at Module.load (internal/modules/cjs/loader.js:815:32)
    at Function.Module._load (internal/modules/cjs/loader.js:727:14)
    at Function.Module.runMain (internal/modules/cjs/loader.js:1047:10)
    at internal/main/run_main_module.js:17:11

The only installation that was done was the nodejs build and gyp

@BridgeAR
Copy link
Member

@saritvakrat internals are loaded with require('internal/path'), so in your case: require('internal/util/comparison'). However, those are not meant to be loaded in userland. They should only be used when working on Node.js itself.

I am closing this since both questions seems to be answered.

@MounicaMercy
Copy link

Hello,
I installed node version- 12.18.4 and when I'm trying to run gulp serve, this is the error im getting.
ReferenceError: primordials is not defined
at fs.js:36:5
at req_ (C:\Users\mounika.pasupunuri\hello-webpart\node_modules\natives\index.js:143:24)
at Object.req [as require] (C:\Users\mounika.pasupunuri\hello-webpart\node_modules\natives\index.js:55:10)
at Object. (C:\Users\mounika.pasupunuri\hello-webpart\node_modules\gulp\node_modules\graceful-fs\fs.js:1:37)
at Module._compile (internal/modules/cjs/loader.js:1137:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10)
at Module.load (internal/modules/cjs/loader.js:985:32)
at Function.Module._load (internal/modules/cjs/loader.js:878:14)
at Module.require (internal/modules/cjs/loader.js:1025:19)
at require (internal/modules/cjs/helpers.js:72:18)
at Object. (C:\Users\mounika.pasupunuri\hello-webpart\node_modules\gulp\node_modules\graceful-fs\graceful-fs.js:3:27)
at Module._compile (internal/modules/cjs/loader.js:1137:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1157:10)
at Module.load (internal/modules/cjs/loader.js:985:32)
at Function.Module._load (internal/modules/cjs/loader.js:878:14)
at Module.require (internal/modules/cjs/loader.js:1025:19)

Thank you in advance.

@Saurabhdaswant
Copy link

All done.
Everything works fine now.
For anyone running into this mistake:

  • Uninstall node.js
  • Delete C:\Users\username\AppData\Roaming\npm folder
  • Delete C:\Users\username\AppData\Roaming\npm-cache folder
  • Reinstall node.js

hey i dont have any AppData folder in my machine its windows 10 what should i do i have also reinstalled node but doesnt work man really need help

@Saurabhdaswant
Copy link

All done.
Everything works fine now.
For anyone running into this mistake:

  • Uninstall node.js
  • Delete C:\Users\username\AppData\Roaming\npm folder
  • Delete C:\Users\username\AppData\Roaming\npm-cache folder
  • Reinstall node.js

hey i dont have any AppData folder in my machine its windows 10 what should i do i have also reinstalled node but doesnt work man really need help

i solved the issue yesssssssssssssssssssssss

@thatONEjustin
Copy link

getting the same issue.

uninstalling node using nvm doesn't work. do i really need to wipe out node scorched earth?

I'm on Monteray 12.1.

npm outut:

evalmachine.<anonymous>:40
} = primordials;
    ^

ReferenceError: primordials is not defined
    at evalmachine.<anonymous>:40:5
    at Object.<anonymous> (/Users/justinp/Desktop/work/projects/project/node_modules/npm/node_modules/graceful-fs/fs.js:11:8)
    at Module._compile (internal/modules/cjs/loader.js:1085:14)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1114:10)
    at Module.load (internal/modules/cjs/loader.js:950:32)
    at Function.Module._load (internal/modules/cjs/loader.js:790:12)
    at Module.require (internal/modules/cjs/loader.js:974:19)
    at require (internal/modules/cjs/helpers.js:101:18)
    at Object.<anonymous> (/Users/justinp/Desktop/work/projects/project/node_modules/npm/node_modules/graceful-fs/graceful-fs.js:3:27)
    at Module._compile (internal/modules/cjs/loader.js:1085:14)

@paradoxalyty
Copy link

Hi
I had the same problem on my macOS Ventura 13.2
I manually completely uninstalled node.js and reinstalled it but the problem didn't resolve.
Then I came across a very simple solution. I just manually installed gulp 4.
npm install --save-dev gulp@4
Here are the detailed instructions that I found - https://rapidevelop.org/javascript/install-gulp-4.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

8 participants