Angular 7 Clarifai api“未在Object ../ node_modules / clarifai / dist / index.js中定义全局”

时间:2018-12-16 13:31:00

标签: angular clarifai

我无法在Angular 7中使用clarifai 给我这个错误

  

index.js:8未捕获的ReferenceError:未定义全局       在Object ../ node_modules / clarifai / dist / index.js(index.js:8)       位于 webpack_require (引导程序:78)       在Module ../ src / app / home / home.component.ts(main.js:231)       位于 webpack_require (引导程序:78)       在Module ../ src / app / app.module.ts(app.component.ts:8)       位于 webpack_require (引导程序:78)       在Module ../ src / main.ts(main.ts:1)       位于 webpack_require (引导程序:78)       在Object.0(main.ts:12)       在 webpack_require (引导程序:78)

此index.js

  

“严格使用”;

     

var App = require('./ App');

     

var _require = require('./../ package.json'),       版本= _require.version;

     

module.exports = global.Clarifai = {版本:版本,应用程序:应用程序,
  GENERAL_MODEL:“ aaa03c23b3724a16a56b629203edc62c”,FOOD_MODEL:   'bd367be194cf45149e75f01d59f77ba7',TRAVEL_MODEL:   'eee28c313d69466f836ab83287a54ed9',NSFW_MODEL:   'e9576d86d2004ed1a38ba0cf39ecb4b1',WEDDINGS_MODEL:   'c386b7a870114f4a87477c0824499348',WEDDING_MODEL:   'c386b7a870114f4a87477c0824499348',COLOR_MODEL:   'eeed0b6733a644cea07cf4c60f87ebb7',CLUSTER_MODEL:   'cccbe437d6e54e2bb911c6aa292fb072',FACE_DETECT_MODEL:   'a403429f2ddf4b49b307e318f00e528b',FOCUS_MODEL:   'c2cf7cecd8a6427da375b9f35fcd2381',LOGO_MODEL:   'c443119bf2ed4da98487520d01a0b1e3',DEMOGRAPHICS_MODEL:   'c0c0ac362b03416da06ab3fa36fb58e3',GENERAL_EMBED_MODEL:   'bbb5f41425b8468d9b7a554ff10f8581',FACE_EMBED_MODEL:   'd02b4508df58432fbb84e800597b8959',APPAREL_MODEL:   'e0be3b9d6a454f0493ac3a30784001ff',MODERATION_MODEL:   'd16f390eb32cad478c7ae150069bd2c6',TEXTURES_AND_PATTERNS:   'fbefb47f9fdb410e8ce14f24f54b47ff',LANDSCAPE_QUALITY:   'bec14810deb94c40a05f1f0eb3c91403',PORTRAIT_QUALITY:   'de9bd05cfdbf4534af151beb2a5d0953'};

如何解决此错误

1 个答案:

答案 0 :(得分:0)

放入polyfills.ts

(任意窗口).global = window;