问题
I'm trying to run the material-ui docs locally. I downloaded the material-ui repository
https://github.com/mui-org/material-ui/
Did the npm install
Now when I try to run it I get the following error
ERROR Failed to compile with 5 errors 11:06:22
These dependencies were not found:
- react-jss/lib/contextTypes in ./packages/material-ui/src/styles/withStyles.js
- react-jss/lib/ns in ./packages/material-ui/src/styles/withStyles.js
- recompose/getDisplayName in ./packages/material-ui/src/styles/withStyles.js
- recompose/wrapDisplayName in ./packages/material-ui/src/styles/withTheme.js, ./packages/material-ui/src/styles/withStyles.js
To install them, you can run: npm install --save react-jss/lib/contextTypes react-jss/lib/ns recompose/getDisplayName recompose/wrapDisplayName
As the error states now when I try to run npm install --save react-jss/lib/contextTypes react-jss/lib/ns recompose/getDisplayName recompose/wrapDisplayName
I get the following errors
- Asking me access to a repository which I have no access to
- npm ERR! Could not install from "react-jss\lib\contextTypes" as it does not contain a package.json file.
How do I get this running locally?
回答1:
Material UI uses yarn workspaces to manage dependencies across multiple packages. To install all the dependencies at once, you need to use yarn instead of npm.
If you use npm
, you need to run npm install
for each of packages in the packages/
directory.
For more info, refer to Material-UI's contributing guidelines
Requirements
- Node >= 8.0
- Latest version of Yarn (how to install/upgrade)
To run the docs locally
1. Clone the repository to your local machine.
$ git clone https://github.com/mui-org/material-ui.git
$ cd material-ui
2. Install dependencies
$ yarn
3. Start the development server
$ yarn run start
You should see the following terminal output:
> Ready on http://localhost:3000
来源:https://stackoverflow.com/questions/50731633/how-do-i-run-material-ui-locally