Getting this error ENOENT: no such file or directory, open 'node:url' when I am trying to run npm run test
Closed this issue · 5 comments
Everything was working fine until last week and when we did npm update and did the npm run test, we are getting the error:
● Test suite failed to run
ENOENT: no such file or directory, open 'node:url'
at Runtime.readFile (node_modules/jest-runtime/build/index.js:1987:21)
at Object.<anonymous> (node_modules/https-proxy-agent/src/index.ts:7:1)
at Object.<anonymous> (node_modules/gaxios/src/gaxios.ts:33:1)
at Object.<anonymous> (node_modules/gaxios/src/index.ts:15:1)
at Object.<anonymous> (node_modules/gcp-metadata/src/index.ts:8:1)
at Object.<anonymous> (node_modules/google-auth-library/build/src/auth/googleauth.js:19:21)
at Object.<anonymous> (node_modules/google-auth-library/build/src/index.js:17:22)
at Object.<anonymous> (node_modules/@google-cloud/common/build/src/util.js:23:31)
at Object.<anonymous> (node_modules/@google-cloud/common/build/src/service-object.js:24:16)
at Object.<anonymous> (node_modules/@google-cloud/common/build/src/operation.js:20:26)
I have this dependencies:
"dependencies": {
"@google-cloud/bigquery": "^7.2.0",
"https-proxy-agent": "^7.0.1",
"@google-cloud/storage": "^7.7.0",
"@walmart/re-prom-golden-signal": "^1.2.4",
"agentkeepalive": "4.1.4",
"axios": "1.6.4"
},
Maybe you need to update your Node.js or Jest version?
Hit this too. not sure why but already on NodeJS 20
Check your other dependencies then. import "node:url"
is a valid import:
Welcome to Node.js v20.11.0.
Type ".help" for more information.
> require('node:url')
{
Url: [Function: Url],
parse: [Function: urlParse],
resolve: [Function: urlResolve],
resolveObject: [Function: urlResolveObject],
format: [Function: urlFormat],
URL: [class URL] {
canParse: [Function: canParse],
createObjectURL: [Function: createObjectURL],
revokeObjectURL: [Function: revokeObjectURL]
},
URLSearchParams: [class URLSearchParams],
domainToASCII: [Function: domainToASCII],
domainToUnicode: [Function: domainToUnicode],
pathToFileURL: [Function: pathToFileURL],
fileURLToPath: [Function: fileURLToPath],
urlToHttpOptions: [Function: urlToHttpOptions]
}
Me too getting this from yesterday.
I found the issue:
The updated version of this package is causing this error.
I resolved it by explicitly mentioning 7.0.1 version at the start of my dependencies in package.json
Thank you everyone for your time.