首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >运行任何gatsby命令都显示"-bash: gatsby:命令未找到“

运行任何gatsby命令都显示"-bash: gatsby:命令未找到“
EN

Stack Overflow用户
提问于 2019-06-07 10:26:02
回答 1查看 944关注 0票数 1

我正试图克隆一个用盖茨比( gatsby )构建的网站,并在我的笔记本电脑上本地运行。但是,键入任何gatsby命令都会在命令提示符上发出以下警告:

-bash: gatsby:命令未找到

我尝试卸载并手动重新安装盖茨比,而不使用GitHub存储库。但还是没有成功。

对于本地站点,我遵循了本站的以下说明:

  1. git clone git@github.com:PlatformOfTrust/pot-websites.git
  2. cd developer-site or marketing-site
  3. npm install
  4. npm install --global gatsby-cli
  5. gatsby develop -o -p 8000

在执行gatsby develop -o -p 8000时,站点应该在localhost:8000本地运行。但是终点站简单地说

-bash: gatsby:命令未找到

下面是终端在执行命令序列时的输出:

代码语言:javascript
复制
Last login: Fri Jun  7 15:15:07 on ttys000
TILMACLT17-2:~ naziahasan$ cd Documents/GitHub/
TILMACLT17-2:GitHub naziahasan$ ls -a
.       ..      .DS_Store   docs
TILMACLT17-2:GitHub naziahasan$ git clone git@github.com:PlatformOfTrust/pot-websites.git
Cloning into 'pot-websites'...
remote: Enumerating objects: 418, done.
remote: Counting objects: 100% (418/418), done.
remote: Compressing objects: 100% (256/256), done.
remote: Total 3958 (delta 267), reused 279 (delta 158), pack-reused 3540
Receiving objects: 100% (3958/3958), 39.25 MiB | 250.00 KiB/s, done.
Resolving deltas: 100% (2384/2384), done.
TILMACLT17-2:GitHub naziahasan$ cd pot-websites/developers-site/
TILMACLT17-2:developers-site naziahasan$ npm install

> fsevents@1.2.7 install /Users/naziahasan/Documents/GitHub/pot-websites/developers-site/node_modules/fsevents
> node install

node-pre-gyp WARN Using request for node-pre-gyp https download 
[fsevents] Success: "/Users/naziahasan/Documents/GitHub/pot-websites/developers-site/node_modules/fsevents/lib/binding/Release/node-v64-darwin-x64/fse.node" is installed via remote

> sharp@0.21.3 install /Users/naziahasan/Documents/GitHub/pot-websites/developers-site/node_modules/gatsby-plugin-sharp/node_modules/sharp
> (node install/libvips && node install/dll-copy && prebuild-install) || (node-gyp rebuild && node install/dll-copy)

info sharp Using cached /Users/naziahasan/.npm/_libvips/libvips-8.7.0-darwin-x64.tar.gz

> sharp@0.21.1 install /Users/naziahasan/Documents/GitHub/pot-websites/developers-site/node_modules/sharp
> (node install/libvips && node install/dll-copy && prebuild-install) || (node-gyp rebuild && node install/dll-copy)

info sharp Using cached /Users/naziahasan/.npm/_libvips/libvips-8.7.0-darwin-x64.tar.gz

> gatsby-telemetry@1.0.2 postinstall /Users/naziahasan/Documents/GitHub/pot-websites/developers-site/node_modules/gatsby-telemetry
> node src/postinstall.js


> gatsby-telemetry@1.0.4 postinstall /Users/naziahasan/Documents/GitHub/pot-websites/developers-site/node_modules/gatsby/node_modules/gatsby-telemetry
> node src/postinstall.js


> cwebp-bin@5.0.0 postinstall /Users/naziahasan/Documents/GitHub/pot-websites/developers-site/node_modules/cwebp-bin
> node lib/install.js

  ✔ cwebp pre-build test passed successfully

> mozjpeg@6.0.1 postinstall /Users/naziahasan/Documents/GitHub/pot-websites/developers-site/node_modules/mozjpeg
> node lib/install.js

  ✔ mozjpeg pre-build test passed successfully

> pngquant-bin@5.0.2 postinstall /Users/naziahasan/Documents/GitHub/pot-websites/developers-site/node_modules/pngquant-bin
> node lib/install.js

  ✔ pngquant pre-build test passed successfully

> styled-components@4.2.0 postinstall /Users/naziahasan/Documents/GitHub/pot-websites/developers-site/node_modules/styled-components
> node ./scripts/postinstall.js || exit 0

Use styled-components at work? Consider supporting our development efforts at https://opencollective.com/styled-components
added 1926 packages from 1048 contributors in 99.154s
TILMACLT17-2:developers-site naziahasan$ npm install --global gatsby-cli
/Users/naziahasan/.npm-global/bin/gatsby -> /Users/naziahasan/.npm-global/lib/node_modules/gatsby-cli/lib/index.js
+ gatsby-cli@2.6.5
updated 1 package in 15.567s
TILMACLT17-2:developers-site naziahasan$ gatsby develop -o -p 8000
-bash: gatsby: command not found
TILMACLT17-2:developers-site nazia

在尝试卸载并重新安装gatsby时,从终端输出的输出如下:

代码语言:javascript
复制
TILMACLT17-2:~ naziahasan$ gatsby --version
-bash: gatsby: command not found
TILMACLT17-2:~ naziahasan$ npm uninstall -g gatsby-cli
removed 296 packages in 1.618s
TILMACLT17-2:~ naziahasan$ npm install -g gatsby-cli
/Users/naziahasan/.npm-global/bin/gatsby -> /Users/naziahasan/.npm-global/lib/node_modules/gatsby-cli/lib/index.js

> core-js@2.6.9 postinstall /Users/naziahasan/.npm-global/lib/node_modules/gatsby-cli/node_modules/core-js
> node scripts/postinstall || echo "ignore"

Thank you for using core-js ( https://github.com/zloirock/core-js ) for polyfilling JavaScript standard library!

The project needs your help! Please consider supporting of core-js on Open Collective or Patreon: 
> https://opencollective.com/core-js 
> https://www.patreon.com/zloirock 

Also, the author of core-js ( https://github.com/zloirock ) is looking for a good job -)


> gatsby-telemetry@1.0.11 postinstall /Users/naziahasan/.npm-global/lib/node_modules/gatsby-cli/node_modules/gatsby-telemetry
> node src/postinstall.js

+ gatsby-cli@2.6.5
added 296 packages from 172 contributors in 14.686s
TILMACLT17-2:~ naziahasan$ gatsby --version
-bash: gatsby: command not found
TILMACLT17-2:~ naziahasan$ 

我想知道是否需要在..npm global/bin/或将gatsby的位置添加到Path变量下更改gatsby配置中的某些内容。

一些帮助将是非常感谢的!谢谢!

EN

回答 1

Stack Overflow用户

发布于 2021-01-11 15:08:36

尝试将gatsby-cli全局安装为管理员

代码语言:javascript
复制
sudo npm i -g gatsby-cli
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/56492560

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档