gatsby的新安装失败,找不到模块'检测端口'

问题描述 投票:1回答:1

所以我要做的就是安装gatsby(第一次在我的系统上)。

我的操作系统是:macOS 10.13.6

我的第一步是确保节点/ npm的版本正确:

nvm install 10
npm -v
 6.14.4
node -v
 v10.20.1

然后我只是尝试安装gatsby cli:

npm install -g gatsby-cli
npm WARN deprecated [email protected]: core-js@<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js@3.
/Users/me/.nvm/versions/node/v10.20.1/bin/gatsby -> /Users/me/.nvm/versions/node/v10.20.1/lib/node_modules/gatsby-cli/lib/index.js

> [email protected] postinstall /Users/me/.nvm/versions/node/v10.20.1/lib/node_modules/gatsby-cli/node_modules/core-js
> node -e "try{require('./postinstall')}catch(e){}"

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 -)


> [email protected] postinstall /Users/me/.nvm/versions/node/v10.20.1/lib/node_modules/gatsby-cli/node_modules/gatsby-telemetry
> node src/postinstall.js || true


> [email protected] postinstall /Users/me/.nvm/versions/node/v10.20.1/lib/node_modules/gatsby-cli
> node scripts/postinstall.js

npm WARN [email protected] requires a peer of acorn@^6.0.0 but none is installed. You must install peer dependencies yourself.

+ [email protected]
added 670 packages from 470 contributors in 26.613s

似乎完成了吗?最后,我尝试运行一些东西:

gatsby --help

/Users/me/.nvm/versions/node/v10.20.1/lib/node_modules/gatsby-cli/node_modules/yoga-layout-prebuilt/yoga-layout/build/Release/nbind.js:53
        throw ex;
        ^

Error: Cannot find module 'detect-port'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
    at Function.Module._load (internal/modules/cjs/loader.js:562:25)
    at Module.require (internal/modules/cjs/loader.js:692:17)
    at require (internal/modules/cjs/helpers.js:25:18)
    at Object.<anonymous> (/Users/me/.nvm/versions/node/v10.20.1/lib/node_modules/gatsby-cli/lib/recipes.js:18:42)
    at Module._compile (internal/modules/cjs/loader.js:778:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
    at Function.Module._load (internal/modules/cjs/loader.js:585:3)

也许我的设置有问题?谢谢。

npm gatsby nvm
1个回答
0
投票

这里是当前gitub问题的链接:https://github.com/gatsbyjs/gatsby/issues/24325

暂时安装纱线并运行yarn buildyarn develop是一种解决方法。

© www.soinside.com 2019 - 2024. All rights reserved.