#node.js #webpack #cypress
Вопрос:
Ребята, кипарис отображает сообщение об ошибке ниже. Я полагаю, что ошибка произошла из-за какого-то установленного мной плагина, но я не могу сказать, какого именно. Кто-нибудь может помочь?
Error: Webpack Compilation Error ./cypress/support/commands.js Module not found: Error: Can't resolve 'cypress' in 'C:DevProjeto_Alper_Caixacypresssupport' resolve 'cypress' in 'C:DevProjeto_Alper_Caixacypresssupport' Parsed request is a module using description file: C:DevProjeto_Alper_Caixapackage.json (relative path: ./cypress/support) Field 'browser' doesn't contain a valid alias configuration Looked for and couldn't find the file at the following paths: [C:DevProjeto_Alper_Caixacypresssupportnode_modules] [C:DevProjeto_Alper_Caixacypressnode_modules] [C:Devnode_modules] [C:node_modules] [C:DevProjeto_Alper_Caixanode_modulescypress] [C:DevProjeto_Alper_Caixanode_modulescypress.js] [C:DevProjeto_Alper_Caixanode_modulescypress.json] [C:DevProjeto_Alper_Caixanode_modulescypress.jsx] [C:DevProjeto_Alper_Caixanode_modulescypress.mjs] [C:DevProjeto_Alper_Caixanode_modulescypress.coffee] @ ./cypress/support/commands.js 5:38-56 @ ./cypress/support/index.js at Watching.handle [as handler] (C:UserslospAppDataLocalCypressCache8.7.0Cypressresourcesapppackagesservernode_modules@cypresswebpack-preprocessordistindex.js:180:23) at C:UserslospAppDataLocalCypressCache8.7.0Cypressresourcesapppackagesservernode_moduleswebpacklibWatching.js:99:9 at AsyncSeriesHook.eval [as callAsync] (eval at create (C:UserslospAppDataLocalCypressCache8.7.0Cypressresourcesapppackagesservernode_modulestapablelibHookCodeFactory.js:33:10), lt;anonymousgt;:6:1) at Watching._done (C:UserslospAppDataLocalCypressCache8.7.0Cypressresourcesapppackagesservernode_moduleswebpacklibWatching.js:98:28) at C:UserslospAppDataLocalCypressCache8.7.0Cypressresourcesapppackagesservernode_moduleswebpacklibWatching.js:73:19 at Compiler.emitRecords (C:UserslospAppDataLocalCypressCache8.7.0Cypressresourcesapppackagesservernode_moduleswebpacklibCompiler.js:499:39) at C:UserslospAppDataLocalCypressCache8.7.0Cypressresourcesapppackagesservernode_moduleswebpacklibWatching.js:54:20 at C:UserslospAppDataLocalCypressCache8.7.0Cypressresourcesapppackagesservernode_moduleswebpacklibCompiler.js:485:14 at AsyncSeriesHook.eval [as callAsync] (eval at create (C:UserslospAppDataLocalCypressCache8.7.0Cypressresourcesapppackagesservernode_modulestapablelibHookCodeFactory.js:33:10), lt;anonymousgt;:6:1) at C:UserslospAppDataLocalCypressCache8.7.0Cypressresourcesapppackagesservernode_moduleswebpacklibCompiler.js:482:27 at C:UserslospAppDataLocalCypressCache8.7.0Cypressresourcesapppackagesservernode_modulesneo-asyncasync.js:2818:7 at done (C:UserslospAppDataLocalCypressCache8.7.0Cypressresourcesapppackagesservernode_modulesneo-asyncasync.js:3522:9) at AsyncSeriesHook.eval [as callAsync] (eval at create (C:UserslospAppDataLocalCypressCache8.7.0Cypressresourcesapppackagesservernode_modulestapablelibHookCodeFactory.js:33:10), lt;anonymousgt;:6:1) at C:UserslospAppDataLocalCypressCache8.7.0Cypressresourcesapppackagesservernode_moduleswebpacklibCompiler.js:464:33 at C:UserslospAppDataLocalCypressCache8.7.0Cypressresourcesapppackagesservernode_modulesgraceful-fsgraceful-fs.js:111:16 at C:UserslospAppDataLocalCypressCache8.7.0Cypressresourcesapppackagesservernode_modulesenhanced-resolvenode_modulesgraceful-fsgraceful-fs.js:61:14
Ответ №1:
Alright so during the troubleshoot our goal would be to reach the nearest version of node required as we can see in below error logs. -bash-3.2$ npm update npm WARN old lockfile npm WARN old lockfile The package-lock.json file was created with an old version of npm, npm WARN old lockfile so supplemental metadata must be fetched from the registry. npm WARN old lockfile npm WARN old lockfile This is a one-time fix-up, please be patient... npm WARN old lockfile npm WARN EBADENGINE Unsupported engine { npm WARN EBADENGINE package: undefined, npm WARN EBADENGINE required: { node: '14.17.0' }, npm WARN EBADENGINE current: { node: 'v17.2.0', npm: '8.1.0' } npm WARN EBADENGINE } added 7 packages, removed 6 packages, changed 57 packages, and audited 350 packages in 11s 64 packages are looking for funding run npm fund for details added 7 packages, removed 6 packages, changed 57 packages, and audited 350 packages in 11s 64 packages are looking for funding run `npm fund` for details As we currently have 17.2.0 and the required is 14.17.0. To fix this npm cache clear npm cache clean --force npm install -g cypress sudo n 14.17.0 rm -rf **put your existing version**. {Perform this in the folder where your previous version of node was installed} Open a new terminal node -v npm install npx cypress open **This works for mac, not tried in windows/ubuntu