I am running my first test in Cypress from VS IDE and Cypress was working while until I encountered the error below without having changed or updated anything..
My Cypress (7.0.0) installed via NPM command using Node.js 14.16.1 is encountering "Module not found: Error: Can't resolve 'cypress/types/lodash" error message when executing my tests.
I have tried to remove all loadash files from the project and executing the code but the error remains unchanged.
Can someone please tell me how I can diagnose or fix this issue!!
Error Message:
Error: Webpack Compilation Error
./cypress/integration/myTests/helloWorld.test.js
Module not found: Error: Can't resolve 'cypress/types/lodash' in 'C:\Users\.....\Documents\.....\Tools\Cypress\Software\cypress\integration\myTests'
resolve 'cypress/types/lodash' in 'C:\Users\.....\Documents\.....\Tools\Cypress\Software\cypress\integration\myTests'
Parsed request is a module
using description file: C:\Users\.....\Documents\.....\Tools\Cypress\Software\package.json (relative path: ./cypress/integration/myTests)
Field 'browser' doesn't contain a valid alias configuration
Looked for and couldn't find the file at the following paths:
[C:\Users\.....\Documents\.....\Tools\Cypress\Software\cypress\integration\myTests\node_modules]
[C:\Users\.....\Documents\.....\Tools\Cypress\Software\cypress\integration\node_modules]
[C:\Users\.....\Documents\.....\Tools\Cypress\Software\cypress\node_modules]
[C:\Users\.....\Documents\.....\Tools\Cypress\node_modules]
[C:\Users\.....\Documents\.....\Tools\node_modules]
[C:\Users\.....\Documents\.....\node_modules]
[C:\Users\.....\Documents\node_modules]
[C:\Users\.....\node_modules]
[C:\Users\node_modules]
[C:\node_modules]
[C:\Users\.....\Documents\.....\Tools\Cypress\Software\node_modules\cypress\types\lodash]
[C:\Users\.....\Documents\.....\Tools\Cypress\Software\node_modules\cypress\types\lodash.js]
[C:\Users\.....\Documents\.....\Tools\Cypress\Software\node_modules\cypress\types\lodash.json]
[C:\Users\.....\Documents\.....\Tools\Cypress\Software\node_modules\cypress\types\lodash.jsx]
[C:\Users\.....\Documents\.....\Tools\Cypress\Software\node_modules\cypress\types\lodash.mjs]
[C:\Users\.....\Documents\.....\Tools\Cypress\Software\node_modules\cypress\types\lodash.coffee]
[C:\Users\.....\Documents\.....\Tools\Cypress\Software\node_modules\cypress\types\lodash\index]
[C:\Users\.....\Documents\.....\Tools\Cypress\Software\node_modules\cypress\types\lodash\index.js]
[C:\Users\.....\Documents\.....\Tools\Cypress\Software\node_modules\cypress\types\lodash\index.json]
[C:\Users\.....\Documents\.....\Tools\Cypress\Software\node_modules\cypress\types\lodash\index.jsx]
[C:\Users\.....\Documents\.....\Tools\Cypress\Software\node_modules\cypress\types\lodash\index.mjs]
[C:\Users\.....\Documents\.....\Tools\Cypress\Software\node_modules\cypress\types\lodash\index.coffee]
@ ./cypress/integration/myTests/helloWorld.test.js 6:4-35
at Watching.handle [as handler] (C:\Users\.....\AppData\Local\Cypress\Cache\7.0.0\Cypress\resources\app\packages\server\node_modules\@cypress\webpack-preprocessor\dist\index.js:172:23)
at C:\Users\.....\AppData\Local\Cypress\Cache\7.0.0\Cypress\resources\app\packages\server\node_modules\webpack\lib\Watching.js:99:9
at AsyncSeriesHook.eval [as callAsync] (eval at create (C:\Users\.....\AppData\Local\Cypress\Cache\7.0.0\Cypress\resources\app\packages\server\node_modules\tapable\lib\HookCodeFactory.js:33:10), <anonymous>:6:1)
at AsyncSeriesHook.lazyCompileHook (C:\Users\.....\AppData\Local\Cypress\Cache\7.0.0\Cypress\resources\app\packages\server\node_modules\tapable\lib\Hook.js:154:20)
at Watching._done (C:\Users\.....\AppData\Local\Cypress\Cache\7.0.0\Cypress\resources\app\packages\server\node_modules\webpack\lib\Watching.js:98:28)
at C:\Users\.....\AppData\Local\Cypress\Cache\7.0.0\Cypress\resources\app\packages\server\node_modules\webpack\lib\Watching.js:73:19
at Compiler.emitRecords (C:\Users\.....\AppData\Local\Cypress\Cache\7.0.0\Cypress\resources\app\packages\server\node_modules\webpack\lib\Compiler.js:499:39)
at C:\Users\.....\AppData\Local\Cypress\Cache\7.0.0\Cypress\resources\app\packages\server\node_modules\webpack\lib\Watching.js:54:20
at C:\Users\.....\AppData\Local\Cypress\Cache\7.0.0\Cypress\resources\app\packages\server\node_modules\webpack\lib\Compiler.js:485:14
at AsyncSeriesHook.eval [as callAsync] (eval at create (C:\Users\.....\AppData\Local\Cypress\Cache\7.0.0\Cypress\resources\app\packages\server\node_modules\tapable\lib\HookCodeFactory.js:33:10), <anonymous>:6:1)
at AsyncSeriesHook.lazyCompileHook (C:\Users\.....\AppData\Local\Cypress\Cache\7.0.0\Cypress\resources\app\packages\server\node_modules\tapable\lib\Hook.js:154:20)
at C:\Users\.....\AppData\Local\Cypress\Cache\7.0.0\Cypress\resources\app\packages\server\node_modules\webpack\lib\Compiler.js:482:27
at C:\Users\.....\AppData\Local\Cypress\Cache\7.0.0\Cypress\resources\app\packages\server\node_modules\neo-async\async.js:2818:7
at done (C:\Users\.....\AppData\Local\Cypress\Cache\7.0.0\Cypress\resources\app\packages\server\node_modules\neo-async\async.js:3522:9)
at AsyncSeriesHook.eval [as callAsync] (eval at create (C:\Users\.....\AppData\Local\Cypress\Cache\7.0.0\Cypress\resources\app\packages\server\node_modules\tapable\lib\HookCodeFactory.js:33:10), <anonymous>:6:1)
at AsyncSeriesHook.lazyCompileHook (C:\Users\.....\AppData\Local\Cypress\Cache\7.0.0\Cypress\resources\app\packages\server\node_modules\tapable\lib\Hook.js:154:20)