npm install无法将派生的Material-ui src编译到lib文件夹中 [英] npm install not compiling forked material-ui src into lib folder

查看:69
本文介绍了npm install无法将派生的Material-ui src编译到lib文件夹中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我的应用程序中使用了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:

  1. 转到fork's页面
  2. 转到commits
  3. 要使用的commit右侧,单击Browse code
  4. 在浏览代码页上,右键单击Download ZIP按钮(或所看到的任何内容)并进行复制.应该是这样的
  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. 编辑该URL,将archive替换为tarball,并删除.zip扩展名.您应该以
  2. 之类的名字结束
  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/fdd4089087d916fa6e3b5 /a>

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

  1. 将其粘贴到您的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?

推荐答案

直接指向您 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屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆