Gatsby:安装节点,Homebrew和npm后运行“ gatsby --help”时出错

时间:2019-12-21 04:46:12

标签: gatsby

在全局成功安装Node(v13.5.0),npm(v6.13.4),Homebrew(v2.2.1)和Gatsby-cli之后,我遇到此错误:

$ gatsby --help
/usr/local/lib/node_modules/gatsby-cli/node_modules/yoga-layout-prebuilt/yoga-layout/build/Release/nbind.js:53
        throw ex;
        ^

Error: Cannot find module '@babel/code-frame'
Require stack:
- /usr/local/lib/node_modules/gatsby-cli/lib/reporter/prepare-stack-trace.js
- /usr/local/lib/node_modules/gatsby-cli/lib/reporter/errors.js
- /usr/local/lib/node_modules/gatsby-cli/lib/reporter/index.js
- /usr/local/lib/node_modules/gatsby-cli/lib/create-cli.js
- /usr/local/lib/node_modules/gatsby-cli/lib/index.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:966:17)
    at Function.Module._load (internal/modules/cjs/loader.js:859:27)
    at Module.require (internal/modules/cjs/loader.js:1028:19)
    at require (internal/modules/cjs/helpers.js:72:18)
    at Object.<anonymous> (/usr/local/lib/node_modules/gatsby-cli/lib/reporter/prepare-stack-trace.js:13:19)
    at Module._compile (internal/modules/cjs/loader.js:1139:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1159:10)
    at Module.load (internal/modules/cjs/loader.js:988:32)
    at Function.Module._load (internal/modules/cjs/loader.js:896:14)
    at Module.require (internal/modules/cjs/loader.js:1028:19) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/usr/local/lib/node_modules/gatsby-cli/lib/reporter/prepare-stack-trace.js',
    '/usr/local/lib/node_modules/gatsby-cli/lib/reporter/errors.js',
    '/usr/local/lib/node_modules/gatsby-cli/lib/reporter/index.js',
    '/usr/local/lib/node_modules/gatsby-cli/lib/create-cli.js',
    '/usr/local/lib/node_modules/gatsby-cli/lib/index.js'
  ]
}

我想念什么吗? 谢谢

1 个答案:

答案 0 :(得分:0)

不确定为什么会遇到问题,但是可以使用以下方法将缺少的模块安装到项目中:

npm install --save-dev babel-code-frame