【问题标题】:Not Found - GET https://registry.npmjs.org/@types%2fol-cesium未找到 - 获取 https://registry.npmjs.org/@types%2fol-cesium
【发布时间】:2023-02-21 06:39:51
【问题描述】:

如何解决这个错误。 我运行这个命令然后得到这个错误,

click here to see image

PS D:\New-Project-Backup\3D Map\3DMapProject> npm i --save-dev @types/ol-cesium
npm ERR! code E404
npm ERR! 404 Not Found - GET https://registry.npmjs.org/@types%2fol-cesium - Not found
npm ERR! 404 
npm ERR! 404  '@types/ol-cesium@*' 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 ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\sanjay\AppData\Local\npm-cache\_logs\2023-02-13T13_25_06_110Z-debug.log

【问题讨论】:

  • 我在 npm registry 上看到有一个名为:ol-cesium 的包你是说 @types/cesium 吗?或者只是 ol-铯?您可以轻松地检查包是否存在于 npmjs.com 下也可以考虑以下包:olcs
  • @PanMichal 我检查过 ol-cesium 在 npmjs.com 中可用。我们现在在干什么 ?
  • 您需要检查您正在寻找的包裹是否也可用
  • @PanMichal 是的,它在 npmjs 中可用。

标签: angular angularjs openlayers


【解决方案1】:

您的包裹ol-cesium 不包括打字。

当没有类型可用时,typescript 会建议您检查 DefinitelyTyped 项目是否有一些名称为您的类型:@types/thirdPartyLib。但现在总是这样。

你必须声明你自己的类型:

declare module 'thirdPartyLib' {
  interface MyLibInterface {
    someFunction(): void
  }
}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2023-02-23
    • 2020-08-29
    • 2021-06-12
    • 2020-05-28
    • 1970-01-01
    • 1970-01-01
    • 2021-09-06
    相关资源
    最近更新 更多