-
Notifications
You must be signed in to change notification settings - Fork 3.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
webpack-preprocessor cleanError throws TypeError #8948
Comments
New package was released today by version 5.4.9 and the dist folder is completely empty. Starting version 4.1.1 I get the This al feels very broken. I need to fix webpack because currently even the most simplest of files are 6MB in size after compilation and it takes on average 4,5 second just to build it (not even importing it to the browser). |
This comment has been minimized.
This comment has been minimized.
There is no problems with webpack@4.44.2 |
I got this error by upgrading to Webpack 5, which I cancelled for the time being. Does this bug mean Not sure if related but the preprocessor files have received some fairly recent changes which may have broken something. (To the maintainers: in passing I've just come across some merge markers left in webpack.js https://github.com/cypress-io/cypress/blob/master/npm/vue/src/preprocessor/webpack.js#L79) |
The underlying problem here seems to be that the webpack instance started by cypress is using a flawed In my case, babel-loader throws an error console.log(require.resolve.paths('schema-utils'));
// [
// <rootDir>/node_modules/babel-loader/node_modules
// <rootDir>/node_modules
// etc.
// ]
// ^ schema-utils is installed in both places, meaning it should resolve to the
// version located at babel-loader/node_modules/schema-utils
console.log(require.resolve('schema-utils'));
// <rootDir>/node_modules/schema-utils/dist/index.js
// ^ instead, it resolves to the version in <rootDir>/node_modules/schema-utils I've also seen this same issue manifest with different versions of |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
2 similar comments
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Please prefer thumbing up the issue over posting "+1" comments (each one of them sends unnecessary email notifications). Thanks |
Can anyone provide a reproducible example? We cannot merge the code to the main branch without writing some test codes. |
Cypress webpack-preprocessor does not yet support Webpack 5 as explained in this issue: #8900 We released a temporary version of this package that supports webpack v5 – npmjs.com/package/cypress-webpack-preprocessor-v5
Is anyone getting this error outside of using Webpack 5? Because we will close this issue if not as it's a duplicate of #8900 |
Hi, using the cypress-webpack-preprocessor-v5 fixes the issue for me. |
Hi,
My package.json dependancies
Am I missing something here? |
@ThaiChingChong You need to install {
"devDependencies": {
"cypress": "6.1.0",
"cypress-webpack-preprocessor-v5": "^5.0.0-alpha.1"
}
} |
Thanks Jennifer. It's working fine now. I've uninstalled the original |
Hi Jeniffer. Similar problem here. Its occurs randomly. I have tried this solution but it didn't help. Error message: Uncaught TypeError: display.replaceAll is not a function
|
I have the same issue. I have installed cypress globally and I have installed dependancies from the project {
"name": "cypress-tests",
"version": "0.1.0",
"dependencies": {
"@bahmutov/cy-api": "^1.4.2",
"cypress-commands": "^1.1.0",
"cypress-file-upload": "^4.0.7",
"is-my-json-valid": "^2.20.4",
"ts-loader": "^8.0.1",
"typescript": "^4.1.2",
"@typescript-eslint/parser": "^4.9.0",
"@testing-library/cypress": "^7.0.2"
}
} I have tried with cypress 6.1.0 and 6.3.0. Also I have tried to install the mentioned cypress-webpack-preprocessor-v5 but I didn't use it before so I didn't add any other configuration for it like adding it to the plugins file etc. |
Yes got the same issue after the fixing |
@brandon-leapyear |
actually I realise now I've edited this file directly in my node_modules folder: node_modules/@cypress/webpack-preprocessor/dist.index.js function cleanseError(err) {
console.log('err = ', err); // add this line
return err.replace(/\n\s*at.*/g, '').replace(/From previous event:\n?/g, '');
} Now running cypress I can see the typescript errors I need to fix. |
Opened nrwl/nx#5906 for nrwl/nx users, as I couldn't find a way to replace |
@jryom I am seeing the exact same |
@msmith1114 for me the error went away after updating to Cypress 7.x 🤷 |
@jryom as for me. |
@krogfast |
This appears to be resolved in cypress as of version 7.6 #15447 UPDATE: spoke too soon. still get "Automatic publicPath is not supported in this browser" since the plugin doesn't allow me to override |
i'm facing the same issue, I put a here is my error
it's a ts error as it can't find the definition for the |
This still does not fix the issue. |
While we're waiting for a fix, we can use patch-package with @mhamri's code line changes, to alleviate the problem a bit (just in case you didn't know). Edit: I am too late with this, due to more recent releases of @cypress/webpack-preprocessor. |
@rkrisztian my code is already part of the package, even the double |
Getting issue with Cypress 9.0 now, with a new installation |
same, any ETA? |
Any updates on this ? |
using seems was an issue with using node 17 |
I am also getting this with node 17 |
Cypress seems to be still broken on node v17. None of the above solutions worked for me so I just downgraded npm... 🤷♂️ |
@JimLynchCodes are you having this issue with cypress >= 7.7.0? Can you confirm you are using the latest version of @cypress/webpack-preprocessor version 5.11.0? |
Started getting a cryptic `TypeError: err.replace is not a function` error when trying to run cypress tests locally. As per suggestion in this GH comment, upgraded and solved problem: cypress-io/cypress#8948 (comment)
Started getting a cryptic `TypeError: err.replace is not a function` error when trying to run cypress tests locally. As per suggestion in this GH comment, upgraded and solved problem: cypress-io/cypress#8948 (comment)
Closing as resolved. If you're experiencing a bug similar to this in Cypress, please open a new issue with a fully reproducible example that we can run. There may be a specific edge case with the issue that we need more detail to fix. |
cypress/npm/webpack-preprocessor/index.ts
Line 379 in 5082238
TypeError: err.replace is not a function
It seems
err
is anError
in my case, not astring
.I'm not familiar enough to make sure it would break anything else, but changing the js output locally to
err.message.replace
fixes things for me.My real error was:
"Module not found: Error: Can't resolve '../../src/Component' in '<mypath>/cypress/component'"
The text was updated successfully, but these errors were encountered: