问题
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