npm在绝对路径中安装软件包(本地和package.json) [英] npm install package in absolute path (Locally and package.json)

查看:371
本文介绍了npm在绝对路径中安装软件包(本地和package.json)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

首先,对天真问题(如果听起来很重复)道歉.

First of all, huge apology for naive question and if this sounds duplicate.

我希望安装一个软件包,例如material-ui,作为外部依赖项,例如./node_module/my-material-ui.问题是除--prefix选项外,我似乎没有找到任何告诉npm做到这一点的选项,但实际上并没有帮助,因为它会将软件包安装在./node_module/my-material-ui/node_modules/material-ui下.实际上,这很有意义,因为它 前缀 安装路径.我四处搜寻,但没有立即找到解决方案.

I wish to install a package, for example material-ui, as an external dependency under a different path like ./node_module/my-material-ui. The problem is I don't seem to find any option to tell npm to do this other than --prefix option which actually doesn't help because it installs the package under ./node_module/my-material-ui/node_modules/material-ui. Infact, this makes sense since it prefixes the installation path. I searched around but didn't immediately find a solution.

现在作为以下问题,您希望指定必须在package.json中安装软件包的位置,而不是使用npm install ...单独(本地)安装上述软件包.换句话说,如何通过在package.json内部进行指定来实现上述目标.

Now as a following question, instead of individually (and locally) installing the aforementioned package using npm install ..., you wish to specify where the package has to be installed in package.json. In other words, how one can achieve the above goal by specifying that inside package.json.

在此先感谢您的帮助和建议!

Thanks in advance for your help and recommendations!

推荐答案

然后

import FlatButton from 'material-ui/FlatButton'; // v0.x
import Button from 'material-ui-next/Button'; // v1.x

这篇关于npm在绝对路径中安装软件包(本地和package.json)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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