无法创建新的Gatsby项目

时间:2018-09-19 11:02:01

标签: gatsby

从Gatsby启动程序创建一个Gatsby网站。

# install the Gatsby CLI globally
npm install -g gatsby-cli

# create a new Gatsby site using the default starter
gatsby new my-blazing-fast-site

但是我有这个

error Couldn't find package "@reach/router@^1.1.1" required by "gatsby@^2.0.0" on the "npm" registry.

Error: Couldn't find package "@reach/router@^1.1.1" required by "gatsby-link@^2.0.0-rc.4" on the "npm" registry.
Error: Couldn't find package "@xtuc/ieee754@^1.2.0" required by "@webassemblyjs/ieee754@1.7.6" on the "npm" registry.
Error: Couldn't find package "@xtuc/long@4.2.1" required by "@webassemblyjs/wast-printer@1.7.6" on the "npm" registry.
Error: Couldn't find package "@xtuc/long@4.2.1" required by "@webassemblyjs/wast-parser@1.7.6" on the "npm" registry.

Error: Command failed: yarnpkg
  • macOS High Sierra 10.13.6
  • npm v5.6

其他项目/库安装没有问题。

我这边有问题吗?

3 个答案:

答案 0 :(得分:0)

npm install --global gatsby-cli

盖茨比新的盖茨比站点https://github.com/gatsbyjs/gatsby-starter-default

答案 1 :(得分:0)

npm login

将解决问题。

更新或安装Mac Xcode后出现此问题。

答案 2 :(得分:0)

尝试使用以下步骤更新到最新的节点版本:

1-卸载盖茨比:

npm uninstall -g gatsby

2-删除您的项目:

请小心!! (-r =递归,-f =强制)。无法撤消。或者,您可以手动删除文件夹。

rm -r -f my-blazing-fast-site

3-将节点更新为最新版本(在这种情况下,我的最新版本为v11.15.0) 如果使用nvm,请运行:

nvm ls-remote //check latest version
nvm install <version> // install
nvm use <version> // I skipped the first two steps and used my latest installed version > nvm use 11

4-重新安装盖茨比:

npm install -g gatsby

5-创建一个新的gatsby项目

gatsby new my-blazing-fast-site

BAM!现在,您应该已经成功安装并创建了项目。

cd my-blazing-fast-site
gatsby develop