我正在使用Clarifai的脸检测模型构建一个React应用程序。当我import Clarifai from "clarifai"
时,VS代码提示我发出以下警告:
Could not find a declaration file for module 'clarifai'. '.../face-recognition/node_modules/clarifai/dist/index.js' implicitly has an 'any' type.
Try `npm i --save-dev @types/clarifai` if it exists or add a new declaration (.d.ts) file containing `declare module 'clarifai';`ts(7016)
我尝试了建议的解决方案,但只得到了错误:
npm i --save-dev @types/clarifai
npm ERR! code E404
npm ERR! 404 Not Found - GET https://registry.npmjs.org/@types%2fclarifai - Not found
npm ERR! 404
npm ERR! 404 '@types/clarifai@*' is not in this registry.
npm ERR! 404 You should bug the author to publish it (or use the name yourself!)
npm ERR! 404
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.
当我运行npm时,我得到一个空白屏幕,检查控制台,并给出以下错误:
Uncaught ReferenceError: process is not defined
_init App.js:124
App App.js:53
js App.js:14
factory react refresh:6
前两个返回到安装在node_modules文件夹中的clarifai文件夹。第三个是我的“导入Clarifai”代码。
API客户端的安装方式是否有问题,或者我的客户端出了什么问题?
谢谢你的帮助!
发布于 2022-02-23 00:02:49
这里发生了很多事情:
process is not defined
中的"Javascript (REST)“片段,因为客户端应用程序不能本机访问process
函数。如果您正在使用webpack,则使用DefinePlugin
包(Uncaught ReferenceError: process is not defined)传递它。还有其他访问process
客户端的方法,我邀请您在上使用google。
如果能帮上忙就告诉我。
发布于 2022-07-17 23:40:40
//在src文件夹中创建一个新文件,并在其中放置以下代码块
申报模块"clarifai";
https://stackoverflow.com/questions/71229471
复制