在Windows10中部署GatsbyJS并输出Hello World!
- 安装 Git: https://gitforwindows.org/
- 安装 Node JS: https://nodejs.org/en/download/
- 然后分别运行以下命令:
3.1.npm install -g yarn
3.2.yarn global add gatsby-cli
3.3.npm install -g gatsby-cli
3.4.gatsby --help
(验证是否安装成功)
3.5gatsby new hello-world https://github.com/gatsbyjs/gatsby-starter-hello-world
(got this from the tutorial page, https://www.gatsbyjs.org/tutorial/part-zero/)
按照上面的步骤安装成功后根据提示进入项目目录 cd hello-world
并且运行项目 gatsby develop
success open and validate gatsby-configs - 0.015s success load plugins - 0.075s success onPreInit - 0.003s success initialize cache - 0.009s success copy gatsby files - 0.100s success onPreBootstrap - 0.013s success createSchemaCustomization - 0.002s success source and transform nodes - 0.058s success building schema - 0.245s success createPages - 0.001s success createPagesStatefully - 0.048s success onPreExtractQueries - 0.001s success update schema - 0.019s success extract queries from components - 0.073s success write out requires - 0.008s success write out redirect data - 0.003s success onPostBootstrap - 0.002s ⠀ info bootstrap finished - 7.692 s ⠀ success run queries - 0.023s - 2/2 87.21/s ⠀ You can now view gatsby-starter-hello-world in the browser. ⠀ http://localhost:8000/ ⠀ View GraphiQL, an in-browser IDE, to explore your site's data and schema ⠀ http://localhost:8000/___graphql ⠀ Note that the development build is not optimized. To create a production build, use gatsby build ⠀ success Building development bundle - 3.389s
这时候在浏览器地址栏输入http://localhost:8000/
即可访问你的第一个hello world
了。