xia*_*aux 5 node.js typescript visual-studio-code
当我运行tsc它给我这个错误输出:
../../../AppData/Roaming/npm/node_modules/typescript/lib/lib.dom.d.ts(15340,11): error TS2430: Interface 'WebGLRenderingContext' incorrectly extends interface 'WebGLRenderingContextBase'.
Types of property 'getExtension' are incompatible.
Type '{ (name: "ANGLE_instanced_arrays"): ANGLEInstancedArrays; (name: "EXT_blend_minmax"): EXTBlendMinMax; (name: "EXT_color_buffer_half_float"): EXTColorBufferHalfFloat; (name: "EXT_frag_depth"): EXTFragDepth; (name: "EXT_sRGB"): EXTsRGB; (name: "EXT_shader_texture_lod"): EXTShaderTextureLOD; (name: "EXT_texture_filter_...' is not assignable to type '{ (extensionName: "EXT_blend_minmax"): EXT_blend_minmax | null; (extensionName: "EXT_texture_filter_anisotropic"): EXT_texture_filter_anisotropic | null; (extensionName: "EXT_frag_depth"): EXT_frag_depth | null; (extensionName: "EXT_shader_texture_lod"): EXT_shader_texture_lod | null; (extensionName: "EXT_sRGB"): EX...'.
Types of parameters 'name' and 'extensionName' are incompatible.
Type '"OES_vertex_array_object"' is not assignable to type '"ANGLE_instanced_arrays"'.
Run Code Online (Sandbox Code Playgroud)
我的tsconfig.json:
{
"compilerOptions": {
"target": "es5",
"module": "commonjs",
"rootDir": "src",
"outDir": "dist",
"strict": true,
"esModuleInterop": true,
"sourceMap": true,
"declaration": true
},
"exclude": [
"node_modules",
"dist"
]
}
Run Code Online (Sandbox Code Playgroud)
tsc是版本Version 3.1.3.
这是我的package.json:
{
"name": "pupp-tf-test",
"version": "0.0.1",
"description": "Try to get environment set up to program using TypeScript, Puppeteer, and TensorFlow.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "xiaodeaux",
"license": "ISC",
"dependencies": {
"@tensorflow/tfjs-node-gpu": "^0.1.18"
},
"devDependencies": {
"@types/node": "^10.12.0"
}
}
Run Code Online (Sandbox Code Playgroud)
.ts我唯一的文件是空的.所以这与文件中的代码无关,因为没有.至少我认为它与该特定文件无关.
另外,我在Windows 10上并使用Visual Studio Code.这是vscode环境信息:
Version: 1.28.1 (user setup)
Commit: 3368db6750222d319c851f6d90eb619d886e08f5
Date: 2018-10-11T18:13:53.910Z
Electron: 2.0.9
Chrome: 61.0.3163.100
Node.js: 8.9.3
V8: 6.1.534.41
Architecture: x64
Run Code Online (Sandbox Code Playgroud)
lmi*_*lmh 10
根据@tafsiri关于tfjs 问题:Compile error with @tensorflow/tfjs-backend-webgl 的说法,问题是:“由现在内置的 webgl 类型和我们当前使用的 @types/webgl2 包之间的冲突引起”。
他给出了下一个解决方案(对我有用):
编辑您的文件tsconfig.json并添加选项skipLibCheck
{
"compilerOptions": {
...
// skip error: Interface 'WebGL2RenderingContext' incorrectly extends interface 'WebGL2RenderingContextBase'.
// https://github.com/tensorflow/tfjs/issues/4201
"skipLibCheck": true
},
...
}
Run Code Online (Sandbox Code Playgroud)
看起来该@types/webgl-ext包( 的间接依赖项)包含 的方法@tensorflow/tfjs-node-gpu声明,该声明与最新版本的 TypeScript 标准库的方法声明不兼容。我不确定对此应该采取什么措施,因此我建议您首先针对提出问题。如果您在那里没有得到答案,那么您可以升级到 TensorFlow.js 支持资源,询问是否可以删除对损坏且明显未维护的包的依赖。getExtensionWebGLRenderingContextgetExtensionWebGLRenderingContextBase@types/webgl-ext
同时,一个可能有效的解决方法是创建您自己的空@types/webgl-ext包的虚拟版本。在项目中创建一个目录来保存虚拟包(例如,假设您将该目录命名为webgl-ext),package.json从真实@types/webgl-ext包中复制 ,创建一个空index.d.ts文件,然后package.json使用相对路径在 main 中注册虚拟包:
"dependencies": {
"@tensorflow/tfjs-node-gpu": "^0.1.18",
"@types/webgl-ext": "./webgl-ext"
},
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
637 次 |
| 最近记录: |