简体   繁体   English

当库有 index.d.ts 文件时,为什么我的应用程序代码会显示“找不到模块的声明文件……”?

[英]Why would my app code show “Could not find a declaration file for module … ” when the library has an index.d.ts file?

This is the library that's causing the problem: simple-social-signin .这是导致问题的库: simple-social-signin

To my understanding, the library doesn't need to have a declare module statement.据我了解,库不需要declare module语句。 What might be wrong?可能有什么问题?

To reproduce the bug:要重现错误:

  1. Install the library安装库

  2. Import:进口:

import { getGoogleUserInfo, getFacebookUserInfo } from 'simple-social-signin';

Also, not sure if that would help, but when I was publishing this package I got this weird error, even though the package was still published and I got the "successfully published" email另外,不确定这是否有帮助,但是当我发布此 package 时,我收到了这个奇怪的错误,即使 package 仍然发布并且我得到了“成功发布” Z0C83F57C786A0B4A39EFAB237C

npm ERR! code E403
npm ERR! 403 403 Forbidden - PUT https://registry.npmjs.org/simple-social-signin - You cannot publish over the previously published versions: 1.0.9.
npm ERR! 403 In most cases, you or one of your dependencies are requesting
npm ERR! 403 a package version that is forbidden by your security policy.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/omar/.npm/_logs/2020-05-18T20_47_59_780Z-debug.log

I checked the logs and they don't have anything meaningful.我检查了日志,它们没有任何意义。

I had to restart VScode for that error to disappear.我必须重新启动 VScode 才能使该错误消失。 Closing the tab didn't fix it.关闭标签并没有解决它。 Weird...诡异的...

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM