I’ve just installed ionic and at the very first try to run “ionic serve” on an empty project I get this error:
TypeScript error in /node_modules/@types/testing-library__react/node_modules/pretty-format/build/index.d.ts(7,13): [react-scripts] ‘=’ expected. TS1005
I think is related to some version problem (any node specific version is needed?)… but some help will be welcome!
I have node v10.16.3
Solution: udpate typescript version on package.json (->3.8.3) and then run “ionic repair” to apply the change Thanks guys!!
1 Like
@maxionionic I changed “typescript” to “3.8.3” in the package.json file. With this I was able to get ionic serve to work.
3 Likes
Same problem here. I’ve just install ionic cli and created a blank react app. As suggested, updating TS to 3.8.3 did the trick
2 Likes
Chiming in with a 3rd vote to update your Typescript to 3.8.3 to resolve this issue. Took a few minutes of a Google search to land here, and far less time to fix the issue.
Hi aaron,
I have already installed typescipt 3.8.3
But when I create a new project the package.json still shows the told version
{
“name”: “myProject”,
“version”: “0.0.1”,
“private”: true,
“dependencies”: {
"@ionic/react": "^5.0.0",
"@ionic/react-router": "^5.0.0",
"@testing-library/jest-dom": "^4.2.4",
"@testing-library/react": "^9.4.0",
"@testing-library/user-event": "^8.0.3",
"@types/jest": "^24.0.25",
"@types/node": "^12.12.24",
"@types/react": "^16.9.17",
"@types/react-dom": "^16.9.4",
"@types/react-router": "^5.1.4",
"@types/react-router-dom": "^5.1.3",
"ionicons": "^5.0.0",
"react": "^16.12.0",
"react-dom": "^16.12.0",
"react-router": "^5.1.2",
"react-router-dom": "^5.1.2",
"react-scripts": "3.4.0",
"typescript": "3.7.4"
}
if i change the typescipt here as 3.8.3 it still gives me the same error.
Can you guide me stepwise how to update the typescript ?
Thanks
@mtashrif after you updates the package.json, run the ‘npm install’ command in the myProject folder.