撰写时间:
2021-01-06
总共:
857
字
转载请注明:
BY-SA 4.0(除特别声明或转载文章外)
Gatsby
配置环境
[安装开发环境 |
GatsbyJS 中文网](https://www.gatsbyjs.cn/tutorial/part-zero/) |
[Resolving EACCES permissions errors when installing packages globally |
npm Docs (npmjs.com)](https://docs.npmjs.com/resolving-eacces-permissions-errors-when-installing-packages-globally) |
安装NVM
curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.35.3/install.sh | bash
# 连接不上更改host
#sudo vim /etc/hosts
#199.232.68.133 raw.githubusercontent.com
nvm install node
更换npm安装源
## 全局更换为淘宝npm
npm config set registry http://registry.npm.taobao.org
# 检测
npm config get registry
## 权限
wsl 20.04 修改dev权限为root
sudo vim /etc/sudoers
#dev ALL=(ALL:ALL) ALL
安装gatsby
## 安装 gatsby-cli
npm install -g gatsby-cli
测试运行
创建一个demo
gatsby new hello-world https://github.com/gatsbyjs/gatsby-starter-hello-world
cd hello-world
gatsby develop
##不指定链接使用默认生成
gatsby new [SITE_DIRECTORY_NAME] [URL_OF_STARTER_GITHUB_REPO]
阅读教程
插件库
[Plugins |
GatsbyJS 中文网](https://www.gatsbyjs.cn/plugins/) |