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

谁都会走 提交于 2019-12-06 22:15:47

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.

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