npm install无法将派生的Material-ui src编译到lib文件夹中 [英] npm install not compiling forked material-ui src into lib folder
问题描述
我在我的应用程序中使用了material-ui.我分叉了材料ui,并回滚到了以前的版本,并在那里进行了一些更改,现在我想在我的项目中使用分叉的仓库,因此我按照以下步骤从
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:
- 转到
fork's
页面 - 转到
commits
- 要使用的
commit
右侧,单击Browse code
- 在浏览代码页上,右键单击
Download ZIP
按钮(或所看到的任何内容)并进行复制.应该是这样的
- 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
- 编辑该URL,将
archive
替换为tarball
,并删除.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/fdd4089087d916fa6e3b5 /a>
https://github.com/SoftwareMarbles/express-jsend/tarball/fdd4089087d916fa6e3b5abaa1ff9dd9ea96df8d
- 将其粘贴到您的package.json中,而不是版本中.像这样:
"express-jsend": "url/from/step/5"
npm install
成功运行,没有给出任何错误,但与我在package.json中使用以下代码运行npm install时相比,它不会编译src
中的js
文件并将它们放在lib
文件夹中
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"
所以我的问题:
为什么npm不编译src文件并将其放在lib文件夹中?
Why is npm not compiling the src files and putting them in lib folder?
推荐答案
直接指向您 callemall/material-ui 存储库不起作用是因为该存储库根目录中的软件包仅用于 building 发布到npm的material-ui软件包.请注意, root package.json 中的名称是"material-ui-build",而不是"material-ui".
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".
实际的material-ui软件包是通过在仓库的根目录中运行npm run build
创建的.这会将material-ui软件包写入回购根目录的build
子目录.
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.
如果要在package.json
的依赖项部分中指向material-ui的github分支,则可以创建一个包含build
子目录内容的新存储库,并将package.json
指向该新存储库.回购(麻烦).像这样:
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 ...
指向自定义github存储库的另一种选择是将有范围的包发布到npm(我从未做过).或者,如果只进行本地开发,则可以使用npm link
将包指向material-ui/build
子目录.
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.
这篇关于npm install无法将派生的Material-ui src编译到lib文件夹中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!