node_modules/@types/node/globals.d.ts:错误TS2451:无法重新声明块作用域变量“控制台”

时间:2019-02-17 17:27:32

标签: javascript node.js typescript react-native expo

我只是按照以下链接上的说明进行操作,以创建一个受.row { display: flex; flex-direction: row; } .col { display: flex; flex-direction: column; } .text { font-size: 20px; color: red; } .text1 { line-height: 2; } .text2 { letter-spacing: .5em; }支持的<script src="https://cdnjs.cloudflare.com/ajax/libs/fabric.js/2.6.0/fabric.js"></script> <div class="row"> <div class="col"> <canvas id="c" width="80" height="100"></canvas> <span class="text text2">text</span> </div> <div class="col text text1"> <span>text</span> <span>text</span> </div> </div>应用。

https://github.com/mathieudutour/create-react-native-app-typescript

我的问题是,当我运行React Native时,出现以下错误:

TypeScript

问题似乎出在$ tsc目录内的软件包上,而不是我的实际代码上。

关于如何获得$ tsc > react-native-typescript@0.1.0 tsc D:\react-native-typescript > tsc node_modules/@types/node/globals.d.ts(164,13): error TS2451: Cannot redeclare block-scoped variable 'console'. node_modules/@types/node/globals.d.ts(217,13): error TS2300: Duplicate identifier 'require'. node_modules/@types/react-native/globals.d.ts(92,14): error TS2300: Duplicate identifier 'RequestInfo'. node_modules/@types/react-native/index.d.ts(8885,14): error TS2300: Duplicate identifier 'require'. node_modules/@types/react-native/index.d.ts(8903,11): error TS2451: Cannot redeclare block-scoped variable 'console'. node_modules/@types/react-native/index.d.ts(8911,18): error TS2717: Subsequent property declarations must have the same type. Property 'geolocation' must be of type 'Geolocation', but here has type 'GeolocationStatic'. node_modules/@types/react-native/index.d.ts(8914,11): error TS2451: Cannot redeclare block-scoped variable 'navigator'. node_modules/typescript/lib/lib.dom.d.ts(15764,13): error TS2451: Cannot redeclare block-scoped variable 'navigator'. node_modules/typescript/lib/lib.dom.d.ts(15940,13): error TS2451: Cannot redeclare block-scoped variable 'console'. node_modules/typescript/lib/lib.dom.d.ts(15997,6): error TS2300: Duplicate identifier 'RequestInfo'. npm ERR! code ELIFECYCLE npm ERR! errno 2 npm ERR! react-native-typescript@0.1.0 tsc: `tsc` npm ERR! Exit status 2 npm ERR! npm ERR! Failed at the react-native-typescript@0.1.0 tsc script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above. npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\Bill\AppData\Roaming\npm-cache\_logs\2019-02-17T17_20_46_096Z-debug.log 的结果的任何想法?

谢谢!

0 个答案:

没有答案