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.

  • Try removing `node_modules` and `yarn.lock` (or `package-lock.json`) and `yarn install` (or `npm install`) again. – Cully Oct 28 '22 at 04:42
  • Does this answer your question? [You gave us a visitor for the node type "ForAwaitStatement" but it's not a valid type](https://stackoverflow.com/questions/39894749/you-gave-us-a-visitor-for-the-node-type-forawaitstatement-but-its-not-a-valid) – Cully Oct 28 '22 at 04:43
  • 1
    No, it's not working. I tried it previously. – Md. Nizam Uddin Mahmud Oct 28 '22 at 05:00

3 Answers3

4

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"
}
  • 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 Oct 31 '22 at 12:29
0
npm i --save --legacy-peer-deps
node_modules
  • 4,790
  • 6
  • 21
  • 37
Yasir
  • 489
  • 5
  • 11
  • 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: https://stackoverflow.com/help/how-to-answer . Good luck – nima Nov 02 '22 at 08: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
    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](/help/how-to-answer). – Community Oct 30 '22 at 23:10