如何修复 - 找不到模块“@okta/okta-react”的声明文件 - 错误?
How to fix - Could not find a declaration file for module '@okta/okta-react' - error?
我在我的应用程序中安装了 @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)
如何解决这个错误?
我尝试了什么?
我检查了这个 blog。我尝试实施此解决方案,但我的应用程序没有 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.
好像还没有类型。您需要在此处遵循开发人员的建议 https://github.com/okta/okta-oidc-js/issues/66#issuecomment-394574326
更改节点版本
在我的例子中出现了[找不到模块:无法解决]错误,它在更改节点版本后得到解决。
以前的版本 = v12.4.0
更新至 = v15.8.0
尝试 nvm 使用 15.8.0(在终端中)
我在我的应用程序中安装了 @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)
如何解决这个错误?
我尝试了什么?
我检查了这个 blog。我尝试实施此解决方案,但我的应用程序没有 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.
好像还没有类型。您需要在此处遵循开发人员的建议 https://github.com/okta/okta-oidc-js/issues/66#issuecomment-394574326
更改节点版本
在我的例子中出现了[找不到模块:无法解决]错误,它在更改节点版本后得到解决。 以前的版本 = v12.4.0 更新至 = v15.8.0
尝试 nvm 使用 15.8.0(在终端中)