我正在努力让盖茨比制作一个新项目,并希望用它来推动一个新博客。所以,我下载了cli,创建了一个新项目,cd进入该文件夹,并尝试运行'gatsby develop',这导致错误我无法找到答案。它说它在我的根目录中找不到预设“react”。当项目文件夹不在那里时,为什么要在我的根目录中查找响应?
这是我的终端的样子:
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
答案 0 :(得分:0)
也许在您的某个组件或页面中,您是从/react
而不是react
导入反应?它应该看起来像import React from 'react'
。