node_modules/@types/three/three-core.d.ts(7800,18)中的错误:错误TS2304:找不到名称“ VRDisplay”

时间:2018-10-06 08:18:06

标签: angular typescript three.js typescript-typings

运行ng serve时,在Angular 6应用程序中出现以下错误

   ERROR in node_modules/@types/three/three-core.d.ts(7800,18): error TS2304: Cannot find name 'VRDisplay'.
node_modules/@types/three/three-core.d.ts(7801,23): error TS2304: Cannot find name 'VRDisplay'.
node_modules/@types/three/three-vrcontrols.d.ts(15,27): error TS2304: Cannot find name 'VRDisplay'.
node_modules/@types/three/three-vreffect.d.ts(20,27): error TS2304: Cannot find name 'VRDisplay'.

以下是我的依赖项

  "dependencies": {
"@angular/animations": "^6.0.3",
"@angular/cdk": "^6.4.5",
"@angular/common": "^6.0.3",
"@angular/compiler": "^6.0.3",
"@angular/core": "^6.0.3",
"@angular/forms": "^6.0.3",
"@angular/http": "^6.0.3",
"@angular/platform-browser": "^6.0.0",
"@angular/platform-browser-dynamic": "^6.0.3",
"@angular/platform-server": "^6.0.0",
"@angular/router": "^6.0.3",
"@ng-toolkit/serverless": "^1.1.41",
"@ng-toolkit/universal": "^1.1.41-beta.110",
"@nguniversal/express-engine": "^6.0.0",
"@nguniversal/module-map-ngfactory-loader": "^6.0.0",
"@types/aws-lambda": "^8.10.13",
"@types/greensock": "^1.15.32",
"@types/three": "^0.92.17",
"aws-serverless-express": "^3.2.0",
"bootstrap": "^4.1.3",
"core-js": "^2.5.4",
"cors": "~2.8.4",
"cp-cli": "^1.1.0",
"gsap": "^2.0.1",
"hamburgers": "^0.9.3",
"load-google-maps-api": "^1.3.2",
"rxjs": "^6.0.0",
"three": "^0.87.1",
"ts-loader": "4.2.0",
"webpack-cli": "^2.1.4",
"zone.js": "^0.8.26"
},

该命令以前运行时没有任何问题,但是我无法确定已更改的内容,运行npm install不会更改任何内容。如果我复制旧版本的node_modules,那么它可以毫无问题地编译,这使我认为它必须是程序包问题,而不是Typescript配置?

1 个答案:

答案 0 :(得分:1)

VRDisplay在TypeScript 2.8和更高版本的dom标准库中定义。检查您的TypeScript版本。如果您的旧node_modules目录在添加对@types/three的引用之前的版本为VRDisplay,则可能起作用。