我在我的应用程序中安装了@okta/okta-react包,但它引发了以下错误?
Could not find a declaration file for module '@okta/okta-react'.
'.../node_modules/@okta/okta-react/dist/index.js' implicitly has an 'any' type.
Try `npm install @types/okta__okta-react` if it exists or add a new declaration (.d.ts)
file containing `declare module '@okta/okta-react';`ts(7016)如何修复此错误?
我试过什么?
我查过这个博客。我试图实现这个解决方案,但我的应用程序没有tsconfig.json。
编辑1:
我试图安装@types/okta__okta-react,但得到了以下错误:
$ npm install @types/okta__okta-react
npm ERR! code E404
npm ERR! 404 Not Found - GET https://registry.npmjs.org/@types%2fokta__okta-react - Not found
npm ERR! 404
npm ERR! 404 '@types/okta__okta-react@latest' is not in the npm 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.发布于 2020-09-14 15:42:06
似乎他们还没有类型。您需要在这里遵循devs的建议,https://github.com/okta/okta-oidc-js/issues/66#issuecomment-394574326。
发布于 2021-07-06 10:11:23
更改节点版本
在我的例子中,没有找到模块:无法解决错误,它在更改节点版本后得到了解决。以前版本= v12.4.0更新为= v15.8.0
尝试nvm使用15.8.0 (在终端)
https://stackoverflow.com/questions/63887425
复制相似问题