我如何在本地运行material-ui

时间:2018-06-07 01:09:19

标签: material-ui

我试图在本地运行material-ui docs。我下载了material-ui存储库

https://github.com/mui-org/material-ui/

npm安装

现在,当我尝试运行它时,我收到以下错误

错误无法编译,有5个错误11:06:22

找不到这些依赖项:

  • react.jss / lib / contextTypes ./packages/material-ui/src/styles/withStyles.js
  • react-jss / lib / ns in ./packages/material-ui/src/styles/withStyles.js
  • 在./packages/material-ui/src/styles/withStyles.js中重构/ getDisplayName
  • 重构/ wrapDisplayName在./packages/material-ui/src/styles/withTheme.js,./packages/material-ui/src/styles/withStyles.js

要安装它们,您可以运行:npm install --save react -jss / lib / contextTypes react -jss / lib / ns recompose / getDisplayName recompose / wrapDisplayName

当我尝试运行时,错误状态正在显示 npm install --save react -jss / lib / contextTypes react -jss / lib / ns recompose / getDisplayName recompose / wrapDisplayName

我收到以下错误

  • 要求我访问我无法访问的存储库
  • npm ERR!无法从" react-jss \ lib \ contextTypes"安装。因为它不包含package.json文件。

如何在本地运行?

2 个答案:

答案 0 :(得分:1)

Material UI使用yarn workspaces来管理多个包的依赖关系。要一次安装所有依赖项,您需要使用yarn而不是npm。

如果您使用npm,则需要为npm install目录中的每个软件包运行packages/

有关详细信息,请参阅Material-UI的contributing guidelines

<强>要求

在本地运行文档

1. 将存储库克隆到本地计算机。

$ git clone https://github.com/mui-org/material-ui.git
$ cd material-ui

2. 安装依赖项

$ yarn

3. 启动开发服务器

$ yarn run start

您应该看到以下终端输出:

 > Ready on http://localhost:3000

答案 1 :(得分:0)

材料UI文档是非常庞大的文档,因此不建议在开发模式下启动。最好具有生产版本并将其本地托管在您的PC上。

首先,克隆存储库。

git clone https://github.com/mui-org/material-ui.git
cd material-ui

使用纱线安装依赖项。

yarn

然后创建文档的优化生产版本。

yarn docs:build

然后在生产环境中部署构建。

yarn docs:start

通过转到package.json文件并查看scripts对象,可以找到更多有用的命令。

相关问题