NPM:尝试直接从github url安装时,缺少dist和src目录 [英] NPM: Missing dist and src directories when trying to install directly from a github url

查看:219
本文介绍了NPM:尝试直接从github url安装时,缺少dist和src目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用的npm软件包已在github上进行了分叉,并修复了一些错误,现在我想在项目中使用分叉的代码,直到合并分叉为止.

An npm package I am using has been forked on github with some bug fixes and I now want to use the forked code in my project until the fork is merged.

在我的package.json中,我更改了依赖中的引用,例如 "cool-package":"^ 0.10.0" 改为"cool-package":"git://github.com/developer-who-forked/cool-package.git",但这无效.

In my package.json I change the reference in dependencies from e.g. "cool-package": "^0.10.0" to "cool-package": "git://github.com/developer-who-forked/cool-package.git" but this doesn’t work.

如果我在更新package.json之后运行npm install,然后进入node_modules/cool-package/,我看不到任何/src文件夹或任何/dist文件夹(通过普通npm安装的所有其他模块似乎至少有一个/dist文件夹).

If I run npm install after updating the package.json and then go in to node_modules/cool-package/ I don’t see any /src folder or any /dist folder (all the other modules installed via normal npm seem to have at least a /dist folder).

我只看到/example文件夹和/test文件夹以及package.json和README.md.如果我通过包含"cool-package":"^ 0.10.0"来安装软件包,则将存在src/和dist/文件夹.

I only see an /example folder and a /test folder alongside a package.json and a README.md. If i’d installed the package by including "cool-package": "^0.10.0" there would be the src/ and dist/ folders.

分叉的存储库或它从其中分叉的原始存储库没有/dist文件夹-它实际上位于.gitignore文件中.因此,我认为我在尝试直接在package.json中访问github存储库时,缺少了创建/dist文件所需的一些构建步骤.

The forked repo, or the original repo it was forked from don’t have a /dist folder - it is actually in the .gitignore file. So I think I am missing some build step that is required to create the /dist files when trying to access github repos directly in the package.json.

推荐答案

我只是在这里快速浏览了一下文档. package.json文档

I just had a quick look at the docs here. package.json docs

似乎您正在使用ssh,但npm需要使用http.

It looks like maybe you are using ssh but npm requires http.

根据您的情况,尝试将存储库切换为:

In your case, try switching the repo to:

https://github.com/developer-who-forked/cool -package.git

这篇关于NPM:尝试直接从github url安装时,缺少dist和src目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆