NPM: Missing dist and src directories when trying to install directly from a github url

放肆的年华 提交于 2019-12-08 16:12:30

问题


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.

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.

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).

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.

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.


回答1:


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

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



来源:https://stackoverflow.com/questions/42647387/npm-missing-dist-and-src-directories-when-trying-to-install-directly-from-a-git

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!