我正在尝试gatsby
以下是我安装gatsby-cli
的方法:
$ npm install --global gatsby-cli
/Users/antkong/.nvm/versions/node/v4.8.6/bin/gatsby -> /Users/antkong/.nvm/versions/node/v4.8.6/lib/node_modules/gatsby-cli/lib/index.js
gatsby-cli@1.1.20 /Users/antkong/.nvm/versions/node/v4.8.6/lib/node_modules/gatsby-cli
├── convert-hrtime@2.0.0
├── hosted-git-info@2.5.0
├── stack-trace@0.0.10
├── resolve-cwd@2.0.0 (resolve-from@3.0.0)
├── source-map@0.5.7
├── bluebird@3.5.1
├── babel-code-frame@6.26.0 (js-tokens@3.0.2, esutils@2.0.2, chalk@1.1.3)
├── execa@0.8.0 (p-finally@1.0.0, strip-eof@1.0.0, is-stream@1.1.0, get-stream@3.0.0, signal-exit@3.0.2, npm-run-path@2.0.2, cross-spawn@5.1.0)
├── fs-extra@4.0.2 (universalify@0.1.1, jsonfile@4.0.0, graceful-fs@4.1.11)
├── common-tags@1.4.0
├── yargs@8.0.2 (decamelize@1.2.0, get-caller-file@1.0.2, camelcase@4.1.0, y18n@3.2.1, which-module@2.0.0, set-blocking@2.0.0, yargs-parser@7.0.0, require-main-filename@1.0.1, require-directory@2.1.1, string-width@2.1.1, cliui@3.2.0, os-locale@2.1.0, read-pkg-up@2.0.0)
├── yurnalist@0.2.1 (strip-bom@3.0.0, detect-indent@5.0.0, leven@2.1.0, semver@5.4.1, object-path@0.11.4, death@1.1.0, is-builtin-module@1.0.0, is-ci@1.0.10, chalk@1.1.3, debug@2.6.9, node-emoji@1.8.1, read@1.0.7, loud-rejection@1.6.0, invariant@2.2.2, rimraf@2.6.2, inquirer@3.3.0)
├── pretty-error@2.1.1 (utila@0.4.0, renderkid@2.0.1)
├── babel-runtime@6.26.0 (regenerator-runtime@0.11.0)
├── lodash@4.17.4
└── core-js@2.5.1
然后,当我尝试打印出版本以确定安装是否成功时,我得到了这个:
$ gatsby --version
module.js:327
throw err;
^
Error: Cannot find module 'regenerator-runtime/runtime'
at Function.Module._resolveFilename (module.js:325:15)
at Function.Module._load (module.js:276:25)
at Module.require (module.js:353:17)
at require (internal/module.js:12:17)
at Object.<anonymous> (/Users/antkong/.nvm/versions/node/v4.8.6/lib/node_modules/gatsby-cli/lib/index.js:88:1)
at Module._compile (module.js:409:26)
at Object.Module._extensions..js (module.js:416:10)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
at Function.Module.runMain (module.js:441:10)
我的npm版本和节点
$ node --version
v4.8.6
$ npm --version
2.15.11
OS平台是macOS High Sierra
安装过程中我错过了什么?
答案 0 :(得分:2)
我们不再支持Node 4了 - 尝试升级到Node 8&amp; NPM 5应该一帆风顺!