- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在尝试使用这些包创建一个 monorepo:
gatsby new gat https://github.com/gatsbyjs/gatsby-starter-default
ERROR
Error in "/Users/angus/coding/monorepo-trials/cra-gatsby-monorepo/node_modules/gatsby-plugin-gatsby-cloud/gatsby-node.js": Cannot read property 'RawSource' of undefined
TypeError: Cannot read property 'RawSource' of undefined
- WebpackAssetsManifest.js:17 Object.<anonymous>
[cra-gatsby-monorepo]/[webpack-assets-manifest]/src/WebpackAssetsManifest.js:17:47
- v8-compile-cache.js:192 Module._compile
[cra-gatsby-monorepo]/[v8-compile-cache]/v8-compile-cache.js:192:30
- loader.js:1092 Object.Module._extensions..js
internal/modules/cjs/loader.js:1092:10
- loader.js:928 Module.load
internal/modules/cjs/loader.js:928:32
- loader.js:769 Function.Module._load
internal/modules/cjs/loader.js:769:14
- loader.js:952 Module.require
internal/modules/cjs/loader.js:952:19
- v8-compile-cache.js:159 require
[cra-gatsby-monorepo]/[v8-compile-cache]/v8-compile-cache.js:159:20
- gatsby-node.js:5 Object.<anonymous>
[cra-gatsby-monorepo]/[gatsby-plugin-gatsby-cloud]/gatsby-node.js:5:53
- v8-compile-cache.js:192 Module._compile
[cra-gatsby-monorepo]/[v8-compile-cache]/v8-compile-cache.js:192:30
- loader.js:1092 Object.Module._extensions..js
internal/modules/cjs/loader.js:1092:10
- loader.js:928 Module.load
internal/modules/cjs/loader.js:928:32
- loader.js:769 Function.Module._load
internal/modules/cjs/loader.js:769:14
- loader.js:952 Module.require
internal/modules/cjs/loader.js:952:19
- v8-compile-cache.js:159 require
[cra-gatsby-monorepo]/[v8-compile-cache]/v8-compile-cache.js:159:20
- resolve-module-exports.ts:197 resolveModuleExports
[cra-gatsby-monorepo]/[gatsby]/src/bootstrap/resolve-module-exports.ts:197:26
- validate.ts:349
[cra-gatsby-monorepo]/[gatsby]/src/bootstrap/load-plugins/validate.ts:349:31
not finished load plugins - 0.930s
npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! gatsby-starter-default@0.1.0 develop: `gatsby develop` npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the gatsby-starter-default@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! /Users/angus/.npm/_logs/2021-05-16T14_05_14_891Z-debug.log error Command failed with exit code 1. info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
然后我尝试从每个包中 nohoisting 所有内容,将以下内容添加到每个包的 package.json 中:
"workspaces": {
"nohoist": [
"**"
]
},
...然后在顶层做
lerna clean
和
lerna bootstrap
.
$ yarn start
yarn run v1.22.10
$ yarn develop
$ gatsby develop
success open and validate gatsby-configs - 0.081s
success load plugins - 0.912s
success onPreInit - 0.041s
success initialize cache - 0.008s
success copy gatsby files - 0.135s
success onPreBootstrap - 0.020s
success createSchemaCustomization - 0.006s
success Checking for changed pages - 0.004s
success source and transform nodes - 0.073s
success building schema - 0.571s
success createPages - 0.001s
success createPagesStatefully - 0.089s
info Total nodes: 43, SitePage nodes: 6 (use --verbose for breakdown)
success Checking for changed pages - 0.001s
success update schema - 0.080s
success write out redirect data - 0.002s
success Build manifest and related icons - 0.073s
success onPostBootstrap - 0.079s
info bootstrap finished - 5.402s
success onPreExtractQueries - 0.001s
success extract queries from components - 1.843s
success write out requires - 0.007s
success run page queries - 0.019s - 1/1 53.60/s
ERROR
(node:9884) [DEP_WEBPACK_MAIN_TEMPLATE_OUTPUT_OPTIONS] DeprecationWarning: MainTemplate.outputOptions is deprecated (use Compilation.outputOptions
instead)
(Use `node --trace-deprecation ...` to show where the warning was created)
ERROR
(node:9884) [DEP_WEBPACK_MAIN_TEMPLATE_REQUIRE] DeprecationWarning: MainTemplate.hooks.require is deprecated (use
JavascriptModulesPlugin.getCompilationHooks().renderRequire instead)
ERROR
(node:9884) [DEP_WEBPACK_COMPILATION_NORMAL_MODULE_LOADER_HOOK] DeprecationWarning: Compilation.hooks.normalModuleLoader was moved to
NormalModule.getCompilationHooks(compilation).loader
ERROR #98124 WEBPACK
Generating development JavaScript bundle failed
undefined
If you're trying to use a package make sure that 'undefined' is installed. If you're trying to use a local file make sure that the path is correct.
ERROR #98124 WEBPACK
Generating development JavaScript bundle failed
undefined
If you're trying to use a package make sure that 'undefined' is installed. If you're trying to use a local file make sure that the path is correct.
ERROR #98124 WEBPACK
Generating development JavaScript bundle failed
undefined
If you're trying to use a package make sure that 'undefined' is installed. If you're trying to use a local file make sure that the path is correct.
ERROR #98124 WEBPACK
Generating development JavaScript bundle failed
undefined
If you're trying to use a package make sure that 'undefined' is installed. If you're trying to use a local file make sure that the path is correct.
ERROR #98124 WEBPACK
Generating development JavaScript bundle failed
undefined
If you're trying to use a package make sure that 'undefined' is installed. If you're trying to use a local file make sure that the path is correct.
ERROR #98124 WEBPACK
Generating development JavaScript bundle failed
undefined
If you're trying to use a package make sure that 'undefined' is installed. If you're trying to use a local file make sure that the path is correct.
failed Building development bundle - 3.780s
ERROR in commons
Module not found: TypeError: Cannot read property 'indexOf' of undefined
ERROR in commons
Module not found: TypeError: Cannot read property 'indexOf' of undefined
ERROR in commons
Module not found: TypeError: Cannot read property 'indexOf' of undefined
ERROR in polyfill
Module not found: TypeError: Cannot read property 'indexOf' of undefined
ERROR in polyfill
Module not found: TypeError: Cannot read property 'indexOf' of undefined
ERROR in polyfill
Module not found: TypeError: Cannot read property 'indexOf' of undefined
webpack compiled with 6 errors
..虽然 cra 运行。
yarn add gatsby -W
在 monorepo 的顶层额外安装 gatsby然后 gatsby 站点运行,但 cra 包失败如下:
There might be a problem with the project dependency tree.
It is likely not a bug in Create React App, but something you need to fix locally.
The react-scripts package provided by Create React App requires a dependency:
"babel-loader": "8.1.0"
Don't try to install it manually: your package manager does it automatically.
However, a different version of babel-loader was detected higher up in the tree:
/Users/angus/coding/monorepo-trials/cra-gatsby-monorepo/node_modules/babel-loader (version: 8.2.2)
Manually installing incompatible versions is known to cause hard-to-debug issues.
If you would prefer to ignore this check, add SKIP_PREFLIGHT_CHECK=true to an .env file in your project.
That will permanently disable this message but you might encounter other issues.
To fix the dependency tree, try following the steps below in the exact order:
1. Delete package-lock.json (not package.json!) and/or yarn.lock in your project folder.
2. Delete node_modules in your project folder.
3. Remove "babel-loader" from dependencies and/or devDependencies in the package.json file in your project folder.
4. Run npm install or yarn, depending on the package manager you use.
In most cases, this should be enough to fix the problem.
If this has not helped, there are a few other things you can try:
5. If you used npm, install yarn (http://yarnpkg.com/) and repeat the above steps with it instead.
This may help because npm has known issues with package hoisting which may get resolved in future versions.
6. Check if /Users/angus/coding/monorepo-trials/cra-gatsby-monorepo/node_modules/babel-loader is outside your project directory.
For example, you might have accidentally installed something in your home folder.
7. Try running npm ls babel-loader in your project folder.
This will tell you which other package (apart from the expected react-scripts) installed babel-loader.
If nothing else helps, add SKIP_PREFLIGHT_CHECK=true to an .env file in your project.
That would permanently disable this preflight check in case you want to proceed anyway.
P.S. We know this message is long but please read the steps above :-) We hope you find them helpful!
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
所以在我看来 gatsby 和 react-scripts 在某种程度上混淆了他们所需的 webpack 版本..?我本以为 nohoisting 一切应该意味着每个包都将完全独立运行,即好像它们是单独的“正常”(即不是单)存储库 - 但情况似乎并非如此..?
yarn 1.22.10
lerna 4.0.0
gatsby 3.5.0
react-scripts 4.0.3
react 17.0.2
最佳答案
您可以尝试将 gatsby 降级到 2.x(因为它使用 Webpack 4)和/或
尝试添加
"workspaces": {
"nohoist": [
"gatsby"
]
}
到 gatsby 项目的 package.json。
关于webpack - monorepo 中的 create-react-app + gatsby 包不会同时运行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/67558504/
我正在尝试将图像的路径作为 Prop 传递给组件 注意:组件和索引页都可以通过相同的路径访问图像。当我将路径作为 Prop 传递时它不起作用 在下面的代码中,我尝试使用 GatbsyImage 和 S
我在 gatsby 中的主要字体是在 index.scss 文件夹中定义的,就像这样在 body 标签中。 body { font-family: "Trebuchet MS", "Helveti
我一直在遵循以下步骤:https://github.com/strapi/gatsby-source-strapi 由于 image >> publicURL 也不起作用,我重新安装了最新版本的 ga
语境 Gatsby , headless CMS 奇迹,旁边是 gatsby-plugin-advanced-sitemap 使生成一个强大的 sitemap.xml文件轻而易举。 该插件支持通过 s
目前,我有两个使用 gatsby.js 开发的站点部署到 example.com 和 blog.example.com。我想创建一个 blog.example.com 的子目录到 example.co
我一直在学习本教程 https://www.gatsbyjs.org/packages/gatsby-image/#art-directing-multiple-images但普通人不可能写出 50
我正在使用 Gatsby 的 createResolver API 将 markdown 转换为 html。它在顶层数据上运行良好。但是,我无法让它在嵌套更深的数组上工作。 这是有效的: functi
当我使用 Gatsby (V2) 路由到新页面时,我正在尝试传递数据 我希望然后能够检索该页面上的数据。这可能吗?我已经研究了很多但没有运气所以我觉得我一定错过了什么......谢谢 最佳答案 如果你
默认情况下,我的 Gatsby 网址类似于 2018-09-06-hexagon 有什么办法可以让他们变成/blog/2018/09/06/hexagon ? 这是我的 gatsby-node.js
我有一个 json 文件和一个包含图像的文件夹 plugins/ └── gatsby-source-cars/ ├── images/ ├── cars.json └── g
在生产环境中运行 gatsby。 16. 在开发机器上工作。 来自服务器的错误: success write out redirect data - 0.002s success Build mani
当我想安装 gatsby starter 时,我在终端中遇到了这些错误。 任何人都知道如何解决它? [4/4] 🔨 Building fresh packages... [6/13] ⠁ shar
我正在创建一个名为“new-app”的项目。成功安装 gatsby 后,我尝试运行命令“gatsby new my-app”。我总是收到一个错误,其中指出: ERROR eating new site
我无法使用 gatsby cli 克隆 gatsby-starter-default.git,因为它使用的“git”url 被我们的防火墙规则阻止 我也尝试将以下内容添加到 git config 但仍
我正在创建一个名为“new-app”的项目。成功安装 gatsby 后,我尝试运行命令“gatsby new my-app”。我总是收到一个错误,其中指出: ERROR eating new site
我按照健全性文档创建了一个 internalLink 类型,并根据有关将 internalLinks 与 graphql api 一起使用的提示,我将其创建为单独的类型,如下所示: export de
我创建了由 Gatsby Cloud(个人试用计划)托管并使用 Contentful 的 Gatsby.js 网站。虽然我没有设置 Robot.txt,但生产站点自动在 HTTP header 处添加
最令人沮丧的部分是我之前有这个工作然后不知何故破坏了它,但我正在使用 gatsby-plugin-sharp 和 gatsby-plugin-image 将照片添加到我的主页并看到这个错误: Gats
我创建了由 Gatsby Cloud(个人试用计划)托管并使用 Contentful 的 Gatsby.js 网站。虽然我没有设置 Robot.txt,但生产站点自动在 HTTP header 处添加
最令人沮丧的部分是我之前有这个工作然后不知何故破坏了它,但我正在使用 gatsby-plugin-sharp 和 gatsby-plugin-image 将照片添加到我的主页并看到这个错误: Gats
我是一名优秀的程序员,十分优秀!