5

I am getting below error from next js app suddenly. Any solution to fix that problem?

./pages/_app.tsx
Error: [BABEL] C:\Projects\skribeNew\app-web\pages\_app.tsx: You gave us a visitor for the node type TSSatisfiesExpression but it's not a valid type
    at verify (C:\Projects\skribeNew\app-web\node_modules\next\dist\compiled\babel\bundle.js:1910:397612)
    at Function.explode (C:\Projects\skribeNew\app-web\node_modules\next\dist\compiled\babel\bundle.js:1910:396515)
    at C:\Projects\skribeNew\app-web\node_modules\next\dist\compiled\babel\bundle.js:1:49254
    at Generator.next (<anonymous>)
    at Function.<anonymous> (C:\Projects\skribeNew\app-web\node_modules\next\dist\compiled\babel\bundle.js:1:79767)
    at Generator.next (<anonymous>)
    at evaluateSync (C:\Projects\skribeNew\app-web\node_modules\next\dist\compiled\babel\bundle.js:1910:717268)
    at Function.sync (C:\Projects\skribeNew\app-web\node_modules\next\dist\compiled\babel\bundle.js:1910:715284)
    at sync (C:\Projects\skribeNew\app-web\node_modules\next\dist\compiled\babel\bundle.js:1:80263)
    at sync (C:\Projects\skribeNew\app-web\node_modules\next\dist\compiled\babel\bundle.js:1910:716601)

I changed the babel types version to previous one, But it did not work.

3

3 Answers 3

5

It was because of an incompatible version issue for the npm package "@babel/plugin-transform-typescript". I fixed to the correct previous version in package.json file. Now it's working fine. Below is the code -

"devDependencies": {    
   "@babel/plugin-transform-typescript": "7.19.3",
}
"resolutions": {   
   "@babel/plugin-transform-typescript": "7.19.3"
}

2
  • I encountered the same thing. Due to having a ^ set for the version of @babel/preset-typescript, @babel/plugin-transform-typescript got bumped to 7.20.0. Manually specifying @babel/plugin-transform-typescript": "7.19.3" resolved the issue.
    – Solders
    Commented Oct 31, 2022 at 12:29
  • 2
    Please do not post your Fiverr, Upwork or any other paid ressources on Stack Overflow.
    – Cow
    Commented Dec 12, 2023 at 13:56
0
npm i --save --legacy-peer-deps
1
  • 2
    While this code may answer the question, providing additional context regarding how and/or why it solves the problem would improve the answer's long-term value. You can find more information on how to write good answers in the help center: stackoverflow.com/help/how-to-answer . Good luck
    – nima
    Commented Nov 2, 2022 at 8:10
-1

I believe I was having the same issue you are currently experiencing not too long ago. My solution came from reorganizing the path that my node files were installed. I installed my node files to a greater hierarchy in the path then created a new folder down the line to hold my project files so that the files were already somewhere in the path. Alternatively, you could try installing globally with npm install -g yarn

Hope this helps! :)

1
  • 1
    Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.
    – Community Bot
    Commented Oct 30, 2022 at 23:10

Not the answer you're looking for? Browse other questions tagged or ask your own question.