Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

When I npm runbuild in vue.js get the error Interface 'NodeRequire' cannot simultaneously extend types 'Require'

ERROR in C:/phpStudy2018/PHPTutorial/WWW/Tms.Web/node_modules/@types/node/globals.d.ts(139,11):
139:11 Interface 'NodeRequire' cannot simultaneously extend types 'Require' and 'RequireFunction'.
  Named property 'cache' of types 'Require' and 'RequireFunction' are not identical.
    137 |
    138 | // For backwards compability
  > 139 | interface NodeRequire extends NodeJS.Require {}
        |           ^
    140 | interface RequireResolve extends NodeJS.RequireResolve {}
    141 | interface NodeModule extends NodeJS.Module {}
    142 |

 error  in C:/phpStudy2018/PHPTutorial/WWW/Tms.Web/node_modules/@types/node/globals.d.ts

ERROR in C:/phpStudy2018/PHPTutorial/WWW/Tms.Web/node_modules/@types/node/globals.d.ts(139,11):

My environment is vue.js + typescript. I don't know if I have any problems with my configuration or with the third-party package Can you give me some useful advice Thank you

like image 596
LiJing Avatar asked Dec 25 '19 03:12

LiJing


2 Answers

I had same problem.

the version of @types/node was 13.1.0 released at Mon, 23 Dec 2019 16:40:55 GMT

in my case, it's working when I use former version 12.12.22

npm install --save-dev @types/[email protected]

like image 118
kyane Avatar answered Sep 28 '22 07:09

kyane


I think it's better to exclude the @types definitions from the compilation: https://stackoverflow.com/a/57113847/1704895

It's amazing simple ( tsconfig.json ):

{
  "compilerOptions": {
    ...,
    "types": []
  }
}
like image 37
Cequiel Avatar answered Sep 28 '22 05:09

Cequiel