问题
I am using material-ui in my app. I forked material ui and rolled back to pervious version and made some changes there, now I want to use the forked repo in my project so I used the following steps to install module from here:
- Go to
fork's
page - Go to
commits
- On the right side of the
commit
you want to use clickBrowse code
- On the browse code page right-click on
Download ZIP
button (or whatever it is that you are seeing) and copy . It should be something like this
https://github.com/SoftwareMarbles/express-jsend/archive/fdd4089087d916fa6e3b5abaa1ff9dd9ea96df8d.zip
- Edit that URL replacing
archive
withtarball
and removing the.zip
extension. You should end up with something like
https://github.com/SoftwareMarbles/express-jsend/tarball/fdd4089087d916fa6e3b5abaa1ff9dd9ea96df8d
- Paste that into your package.json instead of the version. Like this:
"express-jsend": "url/from/step/5"
npm install
runs successfully without giving any errors but it does not compile the js
files in src
and put them in lib
folder as compare to when i run npm install with following code in my package.json
"material-ui": "0.14.4"
So my question:
Why is npm not compiling the src files and putting them in lib folder?
回答1:
The reason pointing directly to your fork of the callemall/material-ui repo does not work is that the package in the root of that repo is only for building the material-ui package that gets published to npm. Note that the name in the root package.json is "material-ui-build" -- not "material-ui".
The actual material-ui package is created by running npm run build
in the root of the repo. This writes the material-ui package to the build
subdirectory of the repo root.
If you want to point to your github fork of material-ui in the dependencies section of your package.json
, you could create a new repo containing the contents of the build
subdirectory and point your package.json
to that new repo (cumbersome). Like this:
git clone git@github.com:callemall/material-ui.git material-ui
cd material-ui
npm install
npm run build
cp -Tr build ../material-ui-package
cd ../material-ui-package
git init .
git add .
git commit -m ...
An alternative to pointing to a custom github repo would be to publish a scoped package to npm (I have never done this). Or if you are only doing local development, you could use npm link
to point your package to the material-ui/build
subdirectory.
来源:https://stackoverflow.com/questions/36447478/npm-install-not-compiling-forked-material-ui-src-into-lib-folder