npm install not compiling forked material-ui src into lib folder

落爺英雄遲暮 提交于 2019-12-08 03:47:39

问题


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:

  1. Go to fork's page
  2. Go to commits
  3. On the right side of the commit you want to use click Browse code
  4. 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

  1. Edit that URL replacing archive with tarball and removing the .zip extension. You should end up with something like

https://github.com/SoftwareMarbles/express-jsend/tarball/fdd4089087d916fa6e3b5abaa1ff9dd9ea96df8d

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

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