javascript - 从外部 js api 文件构建 npm 模块

标签 javascript node.js angular npm webgl-earth

我正在尝试从 this repo 构建一个 npm 包,我有“缩小的”js 文件,IntelliJ 在看到 <script src=""> 时会下载该文件。标签,该文件名为 http_www.webglearth.com_v2_api.js

所以,我已按照 npm official 的说明进行操作和 treehouse ,但不断得到 npm ERR! not a package每次我尝试执行 npm install 时都会出现错误消息在该项目上,我已经上传了我的attempt对于我的 Git-hub 帐户,package.json 如下所示:

 {
  "name": "(web_gl_earth_module)",
  "version": "1.0.0",
  "description": "An npm package to help integrate WEBGL Earth to Angular apps",
  "main": "http_www.webglearth.com_v2_api.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "repository": {
    "type": "git",
    "url": "(https://github.com/webglearth/webglearth2.git)"
  },
  "keywords": [
    "webglearth",
    "globe",
    "visualisation"
  ],
  "author": " (git_hub accounts: petrsloup, klokan)",
  "license": "(Apache-2.0)"
}

我浏览过类似的错误,但没有一个案例场景真正符合我的问题,我不确定我是否以正确的方式尝试此操作,或者它是否可行。

我的最终目标是能够将此存储库导入到 Angular 项目中,但这现在是完全不可能的

最佳答案

package.json 中的名称和版本与可用的 npm 包存储库相比应该是唯一的

关于javascript - 从外部 js api 文件构建 npm 模块,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50410146/

相关文章:

typescript - 如何使用angular2中的链接参数数组从子组件导航到上层路由?

node.js - 仅使用 shell 部署应用程序

javascript - 如果有经过身份验证的用户则显示组件

javascript - 本地 JavaScript - 写入本地文件

javascript - 提供一个对话框以在 Web 应用程序上使用浏览器固有的全屏

node.js - 无法连接到 mongodb

javascript - console.log 和 node.js 中的重定向不起作用?

javascript - 如何在 Angular 5 中使用 javaScript TimeSheet 插件

javascript - 仅限 IE8 - 对象不支持属性或方法 'widget'

javascript - 带有 PHP 的 wordpress 自定义 html 小部件