I have upgraded my project from Wdio version 7 to 8. I am using a yarn version 4 with PnP. While all packages are installed and all of them are stored in the cache folder, I am not able to run my tests (see error attached)
I have checked the C:\Users\XXXXX\AppData\Local\Yarn\Berry\[email protected]\node_modules@wdio\utils\package.json and it includes the export tag.
Any thoughts/suggestions are appreciated.
CONF:
{
"name": "XXXXX",
"version": "2.0.0",
"description": "XXXXX",
"main": "index.js",
"scripts": {
.
.
.
},
"author": "XXXX",
"license": "ISC",
"dependencies": {
"@types/fs-extra": "11.0.4",
"@types/mocha": "^10.0.6",
"@types/node": "^20.11.19",
"@types/promise-ftp": "^1.3.8",
"@types/promise-sftp": "^1.3.8",
"@typescript-eslint/eslint-plugin": "^7.0.1",
"@typescript-eslint/parser": "^7.0.1",
"@wdio/allure-reporter": "^8.32.2",
"@wdio/cli": "8.32.2",
"@wdio/junit-reporter": "8.32.2",
"@wdio/local-runner": "^8.32.2",
"@wdio/mocha-framework": "8.32.2",
"@wdio/reporter": "8.32.2",
"@wdio/spec-reporter": "^8.32.2",
"@wdio/utils": "8.32.2",
"axios": "1.6.7",
"dayjs": "^1.11.10",
"deepmerge": "^4.3.1",
"del": "^7.1.0",
"download": "^8.0.0",
"eml-format": "^0.6.1",
"encodeurl": "^1.0.2",
"eslint": "^8.56.0",
"expect-webdriverio": "^4.11.8",
"extend": "^3.0.2",
"fast-xml-parser": "^4.3.4",
"firefox-profile": "^4.5.0",
"form-data": "^4.0.0",
"fs-extra": "11.2.0",
"make-dir": "^4.0.0",
"mocha": "10.3.0",
"moment": "^2.30.1",
"node-fetch": "^3.3.2",
"node-gyp": "^10.0.1",
"node.extend": "^2.0.3",
"npm-check-updates": "^16.14.15",
"npm-run-all": "^4.1.5",
"pipe-streams-to-promise": "^0.2.0",
"prettier": "^3.2.5",
"promise-ftp": "^1.3.5",
"promise-ftp-common": "^1.1.5",
"promise-retry": "^2.0.1",
"promise-sftp": "^0.11.3",
"recursive-search": "^1.0.1",
"replace-in-file": "^7.1.0",
"ssh2-promise": "^1.0.3",
"tough-cookie": "^4.1.3",
"ts-node": "^10.9.2",
"tsconfig-paths": "^4.2.0",
"typescript": "5.3.3",
"url-parse": "^1.5.10",
"webdriverio": "8.32.2",
"websocket": "^1.0.34",
"yarn-resolutions": "^1.0.4"
},
"packageManager": "[email protected]"
}
ERROR:
× ERROR: Error: No "exports" main defined in C:\Users\XXXXX\AppData\Local\Yarn\Berry\[email protected]\node_modules@wdio\utils\package.json imported from C:\XXX\XXX\test
Require stack:
C:\XXXX\XXX\test\mocha.patch.js
at Function.require$$0.Module._resolveFilename (C:\XXX\XXXXX.pnp.cjs:16321:13)
at Function.Module._resolveFilename.sharedData.moduleResolveFilenameHook.installedValue [as _resolveFilename] (C:\Users\XXXXXX\AppData\Local\Yarn\Berry\[email protected]\node_modules@cspotcode\source-map-support\source-map-support.js:811:30)
at Function.Module._load (node:internal/modules/cjs/loader:841:27)
at Function.require$$0.Module._load (C:\XXXX\XXXX.pnp.cjs:16212:31)
at Module.require (node:internal/modules/cjs/loader:1061:19)
at require (node:internal/modules/cjs/helpers:103:18)
at Object. (C:\automation\webclientui\test\mocha.patch.js:3:15)
at Module._compile (node:internal/modules/cjs/loader:1159:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1213:10)
at require$$0.Module.extensions..js (C:\XXXX\XXXX.pnp.cjs:16364:33)
at Object.require.extensions. [as .js] (C:\XXX\XXX.yarn_virtual\ts-node-virtual-b6128b58e1\3\Users\XXXXX\AppData\Local\Yarn\Berry\cache\ts-node-npm-10.9.2-3f3890b9ac-10c0.zip\node_modules\ts-node\src\index.ts:1608:43)
at Module.load (node:internal/modules/cjs/loader:1037:32)
at Function.Module._load (node:internal/modules/cjs/loader:878:12)
at Function.require$$0.Module._load (C:\XXXX\XXXX.pnp.cjs:16212:31)
at ModuleWrap. (node:internal/modules/esm/translators:169:29)
at ModuleJob.run (node:internal/modules/esm/module_job:193:25)
at async Promise.all (index 0)
at async ESMLoader.import (node:internal/modules/esm/loader:530:24)
at async importModuleDynamicallyWrapper (node:internal/vm/module:438:15)
at async formattedImport (C:\Users\XXXXX\AppData\Local\Yarn\Berry\cache\mocha-npm-10.3.0-2a85896b70-10c0.zip\node_modules\mocha\lib\nodejs\esm-utils.js:9:14)
at async exports.requireOrImport (C:\Users\XXXXX\AppData\Local\Yarn\Berry\cache\mocha-npm-10.3.0-2a85896b70-10c0.zip\node_modules\mocha\lib\nodejs\esm-utils.js:42:28)
at async exports.handleRequires (C:\Users\XXXX\AppData\Local\Yarn\Berry\cache\mocha-npm-10.3.0-2a85896b70-10c0.zip\node_modules\mocha\lib\cli\run-helpers.js:94:28)
at async C:\Users\XXXXX\AppData\Local\Yarn\Berry\cache\mocha-npm-10.3.0-2a85896b70-10c0.zip\node_modules\mocha\lib\cli\run.js:349:25
Process finished with exit code 1
What I have tried to resolve the issue:
- Cleaned the cache folder using 'yarn cache clean --all' and run 'yarn install'
- Checked the package that the error states in my cache folder of my dependencies and found out that the zip file exists as well as the export tag inside its package.json file.
- Removed the yarn.lock file and run 'yarn install'
None of the above resolved my issue.