NPMのVersion管理にNodistを使用していますが、Gatsbyと相性が悪いです。npm run develop
を実行すると以下のようなエラーが出てきます。
npm WARN lifecycle The node binary used for scripts is C:\Program Files (x86)\Nodist\bin\node.exe but npm is using C:\Prfor the node binary npm was executed with.
> gatsby-starter-hello-world@0.1.0 develop C:\Users\admin\Desktop\wordpress-jamstack
> gatsby develop
child_process.js:127
p.open(fd);
^
Error: EBADF: bad file descriptor, uv_pipe_open
at Object._forkChild (child_process.js:127:5)
at setupChildProcessIpcChannel (internal/bootstrap/pre_execution.js:332:30)
at prepareMainThreadExecution (internal/bootstrap/pre_execution.js:57:3)
at internal/main/run_main_module.js:7:1 {
errno: -4083,
code: 'EBADF',
syscall: 'uv_pipe_open'
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! gatsby-starter-hello-world@0.1.0 develop: `gatsby develop`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the gatsby-starter-hello-world@0.1.0 develop script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\admin\AppData\Roaming\npm-cache\_logs\2020-08-12T01_50_06_524Z-debug.log
解決方法は以下の通り、オプションを付けて実行します。
npm run develop --scripts-prepend-node-path
# 実行結果
> gatsby-starter-hello-world@0.1.0 develop C:\Users\admin\Desktop\wordpress-jamstack
> gatsby develop
Debugger listening on ws://127.0.0.1:9229/1a06ac9f-8f25-41a7-b9a1-5a4d3194ab93
For help, see: https://nodejs.org/en/docs/inspector
success open and validate gatsby-configs - 0.056s
success load plugins - 2.471s
success onPreInit - 0.007s
info One or more of your plugins have changed since the last time you ran Gatsby. As
a precaution, we're deleting your site's cache to ensure there's no stale data.
success initialize cache - 0.082s
success copy gatsby files - 2.415s
success onPreBootstrap - 0.268s
success createSchemaCustomization - 0.016s
success Checking for changed pages - 0.004s
success source and transform nodes - 5.392s
success building schema - 0.526s
success createPages - 0.005s
success Checking for changed pages - 0.011s
success createPagesStatefully - 0.197s
success update schema - 0.049s
success write out redirect data - 0.006s
success onPostBootstrap - 0.004s
info bootstrap finished - 67.566s
success onPreExtractQueries - 0.003s
success extract queries from components - 0.403s
success write out requires - 0.035s
success run page queries - 0.059s - 2/2 33.65/s
⠀
You can now view gatsby-starter-hello-world in the browser.
⠀
http://localhost:8000/
⠀
View GraphiQL, an in-browser IDE, to explore your site's data and schema
⠀
http://localhost:8000/___graphql
⠀
Note that the development build is not optimized.
To create a production build, use gatsby build
⠀
success Building development bundle - 38.953s
簡単ですが、以上となります。