我正在尝试从 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/