[英]error with gatsby finding preset “react” when running gatsby develop
I'm trying to get gatsby to make a new project and hopefully use it to power a new blog. 我正在尝试让盖茨比(Gatsby)制作一个新项目,并希望使用它来推动新博客的发展。 So, I downloaded the cli, created a new project, cd into that folder, and tried to run 'gatsby develop', which results in an error I can't find the answer to. 因此,我下载了cli,创建了一个新项目,将cd放入该文件夹,并尝试运行“ gatsby development”,这导致我找不到答案的错误。 It says it can't find preset "react" in my root directory. 它说它在我的根目录中找不到预设的“反应”。 Why is it looking for react in my root directory when the project folder isn't located there? 当项目文件夹不在根目录中时,为什么要在我的根目录中寻找响应?
Here's what my terminal looks like: 这是我的终端的样子:
C:\Users\Kevin Murphy\Desktop\Projects\web-dev-blog (gatsby-starter-default@1.0.0)
λ gatsby develop
success delete html and css files from previous builds — 0.023 s
success open and validate gatsby-config.js — 0.005 s
success copy gatsby files — 0.022 s
success onPreBootstrap — 0.034 s
success source and transform nodes — 0.018 s
success building schema — 0.111 s
success createLayouts — 0.038 s
success createPages — 0.001 s
success createPagesStatefully — 0.035 s
success onPreExtractQueries — 0.000 s
success update schema — 0.042 s
success extract queries from components — 0.064 s
success run graphql queries — 0.027 s
success write out page data — 0.008 s
success write out redirect data — 0.001 s
success onPostBootstrap — 0.001 s
info bootstrap finished - 4.074 s
error There was an error compiling the html.js component for the development server.
See our docs page on debugging HTML builds for help
Error: Module build failed: Error: Couldn't find preset "react" relative to directory "C:\\Users\\Kevi
n Murphy"
- option-manager.js:293
[web-dev-blog]/[babel-core]/lib/transformation/file/options/option-manager.js:293:19
- Array.map
- option-manager.js:275 OptionManager.resolvePresets
[web-dev-blog]/[babel-core]/lib/transformation/file/options/option-manager.js:275:20
- option-manager.js:264 OptionManager.mergePresets
[web-dev-blog]/[babel-core]/lib/transformation/file/options/option-manager.js:264:10
- option-manager.js:249 OptionManager.mergeOptions
[web-dev-blog]/[babel-core]/lib/transformation/file/options/option-manager.js:249:14
- option-manager.js:368 OptionManager.init
[web-dev-blog]/[babel-core]/lib/transformation/file/options/option-manager.js:368:12
- index.js:212 File.initOptions
[web-dev-blog]/[babel-core]/lib/transformation/file/index.js:212:65
- index.js:135 new File
[web-dev-blog]/[babel-core]/lib/transformation/file/index.js:135:24
- pipeline.js:46 Pipeline.transform
[web-dev-blog]/[babel-core]/lib/transformation/pipeline.js:46:16
- index.js:46 transpile
[web-dev-blog]/[babel-loader]/lib/index.js:46:20
- fs-cache.js:79
[web-dev-blog]/[babel-loader]/lib/fs-cache.js:79:18
- fs-cache.js:15 ReadFileContext.callback
[web-dev-blog]/[babel-loader]/lib/fs-cache.js:15:14
Maybe in one of your components or pages, you're importing react from /react
instead of just react
? 也许在您的组件或页面之一中,您是从/react
导入/react
而不是react
? It should look like import React from 'react'
. 它看起来应该像import React from 'react'
一样。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.