Currently, I am responsible for maintaining an application that utilizes Angular 7.0.7 and Node 10.20.1.
Everything was running smoothly until yesterday when my PC unexpectedly restarted. Upon trying to run ng serve
, I encountered the following error:
ERROR in node_modules/sweetalert2/sweetalert2.d.ts(277,39): error TS1005: ',' expected. node_modules/sweetalert2/sweetalert2.d.ts(277,68): error TS1011: An element access expression should take an argument. node_modules/sweetalert2/sweetalert2.d.ts(277,69): error TS1005: ';' expected. node_modules/sweetalert2/sweetalert2.d.ts(277,70): error TS1128: Declaration or statement expected. node_modules/sweetalert2/sweetalert2.d.ts(277,82): error TS1005: '(' expected.
The content of my package.json file is as follows:
{
"name": "frontend",
"version": "0.0.0",
... (package.json content continues here)
}
In attempting to resolve this issue, I have tried several troubleshooting methods:
- I uninstalled and reinstalled all node modules using
npm install
, but the issue persisted. - Downgrading TypeScript to version 2.X did not resolve the problem either.
- Reinstalling just Sweetalert using
also proved unsuccessful.npm uninstall sweetalert2 && npm install sweetalert2
- Running
npm audit fix
highlighted numerous issues within the app, none of which resolved the original error.
Examining the Sweetalert file at the specified error line, I came across the following code snippet:
/**
* Provide an array of SweetAlert2 parameters to show multiple popups, one popup after another.
*
* @param steps The steps' configuration.
*/
function queue<T>(steps: readonly (SweetAlertOptions | string)[]): Promise<T>;
Despite trying various solutions, the error remained consistent... What could be causing this issue?