jest: TypeError: _gracefulFs(...).realpathSync.native is not a function
Hi, I got this weird error, am I missing something ?
š Bug Report
When i try to run jest from the cli i got this error. Here is the complete traceback:
TypeError: _gracefulFs(...).realpathSync.native is not a function
at tryRealpath (C:\Users\malau\Documents\ProjetJS\MOPJs\node_modules\jest-config\node_modules\jest-util\build\tryRealpath.js:26:39)
at getCacheDirectory (C:\Users\malau\Documents\ProjetJS\MOPJs\node_modules\jest-config\build\getCacheDirectory.js:89:33)
at Object.<anonymous> (C:\Users\malau\Documents\ProjetJS\MOPJs\node_modules\jest-config\build\Defaults.js:39:50)
at Module._compile (module.js:653:30)
at Object.Module._extensions..js (module.js:664:10)
at Module.load (module.js:566:32)
at tryModuleLoad (module.js:506:12)
at Module.require (module.js:597:17)
at require (internal/module.js:11:18)
To Reproduce
Steps to reproduce the behavior:
npm install --save-dev jest jest-cli; npx jest --init
or .\node_modules\.bin\jest --init
Even just npx jest
fail with the same error.
Link to repl or repo (highly encouraged)
envinfo
npx: installed 1 in 2.519s
System:
OS: Windows 10 10.0.18362
CPU: (4) x64 Intel(R) Core(TM) i5-6300HQ CPU @ 2.30GHz
Binaries:
Node: 8.12.0 - C:\Program Files\nodejs\node.EXE
npm: 6.4.1 - C:\Program Files\nodejs\npm.CMD
npmPackages:
jest: ^26.0.1 => 26.0.1
EDIT: With the latest version of node (14.2.0) it works without any issues.
Thank you in advance for your help !
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Reactions: 8
- Comments: 25 (3 by maintainers)
Commits related to this issue
- Drop Node.js8 from CI settings Node.js8 is not supported by jest. https://github.com/facebook/jest/issues/10012 — committed to abetomo/node-ss2json by abetomo 4 years ago
- Drop Node.js8 from CI settings Node.js8 is not supported by jest. https://github.com/facebook/jest/issues/10012 — committed to abetomo/node-ss2json by abetomo 4 years ago
- Upgrade packages (#106) * Upgrade packages * googleapis * jest * standard * Drop Node.js8 from CI settings Node.js8 is not supported by jest. https://github.com/facebook/jest/issues/10012 — committed to abetomo/node-ss2json by abetomo 4 years ago
- Restrict node version to 10.14.2 specified in package.json This will prevent installation of jest when node version is incompatible. It is related to #10012 — committed to MalauD/jest by MalauD 4 years ago
- Restrict node version to version specified in package.json This will prevent installation of jest when node version is incompatible with requirements specified in package.json. It is related to #1001... — committed to MalauD/jest by MalauD 4 years ago
- Remove support of node 8.x By jest issue: https://github.com/facebook/jest/issues/10012 — committed to lopatnov/make-iterable by lopatnov 4 years ago
We do not support node 8, you need to upgrade to node 10 or keep using Jest 25 which supports node 8
What a wonderfully productive way to ensure you get help with your issue
This is part of Node.js core
https://nodejs.org/api/fs.html#fs_fs_realpathsync_native_path_options
Sorry, but Iām not too clear on why this issue is closed. Iām running Mac OS Catalina, and have the same issue.
Iāve tried: Deleting, recloning and
npm install
my git repository. Each time, I deletepackage-lock.json
andnode_modules
in their entirety. This seemed to fix an issue that was happening withfs
during npm install�Anyway, the error still persisted, so I tried rolling back to Node.js 12.17.0 (was previously on 14). Same error occurs.
I tried completely removing node version manager and reinstalling Node, only to still find the same issue. I canāt find much help anywhere else online, so I thought Iād leave a comment here. The weirdest part is that it works on my older macbook which is running the same OS with the same version of node, installed with nvm. It also works on my Ubuntu workstation.
Hereās my
envinfo
andpackage.json
, if it helps. This is the first time Iām reporting an issue, so do let me know if thereās anything else I can provide!envinfo
package.json
i updated to 12, still having the same error. do i need to stay at exactly 10?
I got the same error with Jest but my cause was because of the node version i was usingā¦I upgraded from 8.16 to the latest version 12 and the error disappeared.Sounds like older versions of node are slowly becoming deprecated while using Jest
The same for me, I updated to node 14.6.0, running the jest is ok, when debugging the jest, I got the same error
Confirm the problem. If it relates to the node version my node is 10.15.0.
Easiest way to re-install dependencies after upgrading Node version to 10+ is to remove
node_modules
andpackage-lock.json
. Just typeyarn
ornpm i
from there š