在运行 npx create-react-app my-app 时,我遇到了 10 个中等严重程度的漏洞。即使运行 npmauditfix 或 npmauditfix--force 后也无法修复。当我运行 npmauditfix --force 时,我得到了 44 个漏洞(25 个低漏洞、5 个中漏洞、14 个高漏洞),然后,如果我运行相同的命令来修复,我会得到 10 个中等严重漏洞。每次我运行命令时,这种情况都会持续循环。
$ npm audit
# npm audit report
browserslist 4.0.0 - 4.16.4
Severity: moderate
Regular Expression Denial of Service - https://npmjs.com/advisories/1747
fix available via `npm audit fix --force`
Will install react-scripts@1.1.5, which is a breaking change
node_modules/react-dev-utils/node_modules/browserslist
react-dev-utils >=6.0.0-next.03604a46
Depends on vulnerable versions of browserslist
node_modules/react-dev-utils
react-scripts >=0.10.0-alpha.328cb32e
Depends on vulnerable versions of @pmmmwh/react-refresh-webpack-plugin
Depends on vulnerable versions of react-dev-utils …Run Code Online (Sandbox Code Playgroud) 当我进入npm install相关的react项目文件夹时,安装节点模块后返回此错误
27 vulnerabilities (16 moderate, 9 high, 2 critical)
To address all issues (including breaking changes), run:
npm audit fix --force
Run `npm audit` for details.
Run Code Online (Sandbox Code Playgroud)
并npm audit fix --force给出这个输出=>
npm WARN using --force Recommended protections disabled.
npm WARN audit Updating react-scripts to 0.9.5,which is a SemVer major change.
npm WARN deprecated har-validator@5.1.5: this library is no longer supported
npm WARN deprecated querystring@0.2.0: The querystring API is considered Legacy. new code should use the URLSearchParams …Run Code Online (Sandbox Code Playgroud) 声明并完成所有配置文件后,当我启动服务器时,我得到 Buffer not Defined 并且错误指向 npm 模块。
Uncaught ReferenceError: Buffer is not definedat node_modules/jsesc/jsesc.js
我决定升级到新版本的 create-react-app ,之后我尝试通过“npm start”启动该应用程序,每当它加载到屏幕上时,就会弹出以下错误:
\n编译时出现问题:X\nERROR\n插件“react”与“package.json \xc2\xbb eslint-config-react-app \xc2\xbb C:\\Users\\27par\\Desktop\\React Projects\”之间发生冲突\development\\finevines\\node_modules\\eslint-config-react-app\\base.js”和“BaseConfig \xc2\xbb C:\\Users\\27par\\Desktop\\React Projects\\Development\\ Finevines\\node_modules\\eslint-config-react-app\\base.js”。
\n错误图像:\n https://gyazo.com/a03be194379ea52e6d7ddd697eefb8aa
\n我想知道是否有其他人遇到与我相同的问题,以及是否有任何可能的解决方案。
\n谢谢。
\n我通过 create-react-app 4.0.3 创建了一个项目,它使用 tailwindcss 2。我只是尝试将项目升级到 tailwindcss 3,但很快就遇到了麻烦,因为 tailwindcss 3 依赖于 Post CSS 8,而 create 不支持 Post CSS 8 -react-app 4.0.3 ,所以我还需要升级到 create-react-app 5.0.0
\n官方的 Create-React-App 文档说:“在大多数情况下,将react-scripts版本引入此文件夹package.json并npm install在该文件夹中运行应该足够了,但\xe2\x80\x99s最好查阅变更日志以了解潜在的重大更改。 ”
官方的 Tailwind 升级指南说“使用 npm 更新 Tailwind,以及 PostCSS 和 autoprefixer ”,并添加了一些小的更改tailwind.config.js
我按照这个步骤操作,但在尝试运行时出现了巨大的错误消息npm run start
我认为最终从新的 5.0.0 create-react-app 安装中设置项目可能会更容易,我在顶部安装了 tailwind 3,而不是尝试修复升级引起的所有问题。
\n然而,在我这样做之前,我想问:从 tailwind 2 升级到 3 以及从 create-react-app 从 4.0.3 升级到 5.0.0 的推荐解决方案是什么(因为我的理解是你需要同时执行这两项操作)使顺风发挥作用)。其他人是如何解决上述问题的?
\nI\xe2\x80\x99m 使用react-app-rewired并且我想禁用每次编译时出现的 Typescript 警告覆盖。由于我不明白的原因,叠加层上出现了 VSCode Typescript 检查器未检测到的警告;webpack 是一个更严格的执行者(实际上比我想要的更严格)。
不管怎样,我尝试过react-app-rewired start --no-client-overlay,我为我的config-overrides.js文件尝试过这个:
module.exports = {\n webpack: function (config, _) {\n config.devServer = {\n client: {\n overlay: false\n }\n }\n return config\n }\n}\nRun Code Online (Sandbox Code Playgroud)\n两者都没有任何效果。知道如何禁用覆盖会很好,但同样好的解决方案是如何让编译器使用与 VSCode 相同的严格级别。
\n最初,我将我的 React 应用程序(使用 create-react-app 创建)部署到了 Github Pages,并且运行良好。但是,对文件进行一些更改后src,我想更新网站,因此我决定使用重新部署应用程序npm run deploy,并Published在命令末尾打印它。在 Github 上,操作显示构建成功,但无法部署,错误代码为 400。
来自Github的完整错误日志如下:
Actor: github-pages[bot]
Action ID: 1996792679
Artifact URL: https://pipelines.actions.githubusercontent.com/P4vIRQYdOzrk38NoGmJNrF5GvwW7S92VAUyJNinMXyLtZzPbIB/_apis/pipelines/workflows/1996792679/artifacts?api-version=6.0-preview
{"count":1,"value":[{"containerId":354579,"size":3092480,"signedContent":null,"fileContainerResourceUrl":"https://pipelines.actions.githubusercontent.com/P4vIRQYdOzrk38NoGmJNrF5GvwW7S92VAUyJNinMXyLtZzPbIB/_apis/resources/Containers/354579","type":"actions_storage","name":"github-pages","url":"https://pipelines.actions.githubusercontent.com/P4vIRQYdOzrk38NoGmJNrF5GvwW7S92VAUyJNinMXyLtZzPbIB/_apis/pipelines/1/runs/2/artifacts?artifactName=github-pages","expiresOn":"2022-06-15T05:21:40.7473658Z","items":null}]}
Creating deployment with payload:
{
"artifact_url": "https://pipelines.actions.githubusercontent.com/P4vIRQYdOzrk38NoGmJNrF5GvwW7S92VAUyJNinMXyLtZzPbIB/_apis/pipelines/1/runs/2/artifacts?artifactName=github-pages&%24expand=SignedContent",
"pages_build_version": "8e6a4594c3e946a3f32ab67af68f527ec66ffc90",
"oidc_token": "***"
}
Failed to create deployment for 8e6a4594c3e946a3f32ab67af68f527ec66ffc90.
{"message":"Deployment request failed for 8e6a4594c3e946a3f32ab67af68f527ec66ffc90 due to in progress deployment. Please cancel c1852e5059b99567d48405d0610990fdc25f0946 first or wait for it to complete.","documentation_url":"https://docs.github.com/rest/reference/repos#create-a-github-pages-deployment"}
Error: Error: Request failed with status code 400
Error: Error: Request failed with status …Run Code Online (Sandbox Code Playgroud) 我想创建一个使用非常基本组件的 monorepo(最好没有 Nx、Rush、Turborepo 等)
我想要一个“应用程序”,例如由存储库中的 create-react-app 创建,然后是该应用程序在单一存储库中的单独包中使用的其他一些组件
我还没有找到一种方法,可以轻松地增量重新编译组件包,而无需我手动进入并在单个组件包上运行构建
我正在查看打字稿“项目参考”,看看这是否有帮助,但我不确定我是否已根据需要将其完全连接起来。我还没有具有增量构建的命令。
此处示例 https://github.com/cmdcolin/monorepo_template
概括
workspace-a- 包含React组件,取决于workspace-bworkspace-b- 包含React组件,无依赖项app- 一个create-react-app实例,渲染一个 React 组件workspace-a如何才能使当我位于yarn start应用程序目录中时,对工作空间 a 或工作空间 b 的更改将在网页上自动更新?添加在另一个窗口中运行的另一个子命令也可以
create-react-app ×10
reactjs ×7
npm ×3
typescript ×2
button ×1
chakra-ui ×1
cra ×1
github-pages ×1
monorepo ×1
npm-audit ×1
npm-install ×1
npm-start ×1
package.json ×1
storybook ×1
tailwind-css ×1
vite ×1