我之前已经安装了 npm,但由于某种原因我不得不卸载它。现在,我尝试再次安装 npm 以使用此命令创建 React 应用程序。
npx create-react-app ip_tracker
安装到一半的时候发现这个错误
npm ERR! code FETCH_ERROR
npm ERR! errno FETCH_ERROR
npm ERR! invalid json response body at https://registry.npmjs.org/@babel%2fpreset-react reason: Unexpected end of JSON input
npm ERR! A complete log of this run can be found in:
npm ERR! /home/ngebelcilik/.npm/_logs/2020-11-27T14_34_28_241Z-debug.log
Run Code Online (Sandbox Code Playgroud)
这是日志
0 verbose cli [
0 verbose cli '/usr/bin/node',
0 verbose cli '/usr/share/nodejs/npm/bin/npm-cli.js',
0 verbose cli 'exec',
0 verbose cli '--',
0 verbose cli 'create-react-app',
0 verbose cli 'ip_tracker'
0 verbose cli ] …Run Code Online (Sandbox Code Playgroud) 我的反应应用程序中有错误,它说:
Line 0: Parsing error: Cannot find module 'eslint-scope' from '/home/path/.cache/yarn/v6/npm-eslint-7.11.0-aaf2d23a0b5f1d652a08edacea0c19f7fadc0b3b-integrity/node_modules/eslint/lib/api.js'
Run Code Online (Sandbox Code Playgroud)
然后我使用以下命令将 eslint-scope 添加到我的依赖项中:
yarn add eslint-scope
Run Code Online (Sandbox Code Playgroud)
但是我发现了很多未满足的对等依赖项:
warning " > @testing-library/user-event@12.1.10" has unmet peer dependency "@testing-library/dom@>=7.21.4".
warning " > eslint-config-react-app@6.0.0" has unmet peer dependency "@typescript-eslint/eslint-plugin@^4.0.0".
warning " > eslint-config-react-app@6.0.0" has unmet peer dependency "@typescript-eslint/parser@^4.0.0".
warning " > eslint-config-react-app@6.0.0" has unmet peer dependency "babel-eslint@^10.0.0".
warning " > eslint-config-react-app@6.0.0" has unmet peer dependency "eslint-plugin-flowtype@^5.2.0".
warning " > eslint-config-react-app@6.0.0" has unmet peer dependency "eslint-plugin-import@^2.22.0".
warning " > eslint-config-react-app@6.0.0" has unmet peer dependency …Run Code Online (Sandbox Code Playgroud) 我有一个用于全局样式的 CSS 规则,该样式有效,但我的终端一直向我显示此警告,如何禁用它?
\nsrc/components/Navbar.svelte changed. rebuilding...\n\xe2\x80\xa2 server\nsrc/routes/index.svelte\nModule Warning (from ./node_modules/svelte-loader-hot/index.js):\nUnused CSS selector "*" (22:2)\n20: \n21: <style global>\n22: * {\n ^\n23: font-family: 'Poppins';\n24: }\n\xe2\x80\xa2 client\nsrc/routes/index.svelte\nModule Warning (from ./node_modules/svelte-loader-hot/index.js):\nUnused CSS selector "*" (22:2)\n20: \n21: <style global>\n22: * {\n ^\n23: font-family: 'Poppins';\n24: }\n\xe2\x9c\x94 service worker (73ms)\n\nRun Code Online (Sandbox Code Playgroud)\n 我想将我的图像放在页面的最右侧,我尝试使用 和 进行position: absolute修改right: 0。我还尝试将父位置设置为相对位置,将图像位置设置为绝对位置,但为什么它不起作用?
这是我的 jsx 文件
<div className={styles.images}>
<Image
src="/cloud.svg"
alt="Picture of the author"
layout="fill"
className={styles.cloud}
/>
<Image
src="/kuil.svg"
alt="Picture of the author"
height={200}
width={600}
layout="intrinsic"
className={styles.building}
/>
</div>
Run Code Online (Sandbox Code Playgroud)
也在我的 css 文件中。
.images {
position: relative;
margin: 90px auto 0 auto;
}
.building {
position: absolute;
top: 0;
right: 0 !important;
bottom: 0 !important;
}
Run Code Online (Sandbox Code Playgroud)
我有一些卡片,我想让它看起来像这样
[] [] []
[] [] []
[] [] []
...
...
Run Code Online (Sandbox Code Playgroud)
我在使用地图功能渲染项目时遇到问题。我已经尝试过这个,但它不起作用。对于每个索引,如果索引可被 3 整除,我想创建新行。我怎样才能做到这一点?
{products.map((val, index) => (
{ index%3 == 0 ? <div className="row mx-auto"> : null}
<Card>
{val.description}
</Card>
{ index%3 == 0 ? </div> : null}
))}
Run Code Online (Sandbox Code Playgroud)
任何帮助,将不胜感激。
我阅读了这些关于结构的文档,但我不了解单元结构。它说:
单元结构最常用作标记。它们的大小为零字节,但与空枚举不同,它们可以被实例化,使它们与单元类型同构
()。当您需要在某物上实现特征但不需要在其中存储任何数据时,单元结构很有用。
他们只以这段代码为例:
struct Unit;
Run Code Online (Sandbox Code Playgroud)
使用单元结构的真实示例是什么?
我有 nextjs 应用程序+打字稿+反应传单
当我启动我的开发服务器时,npm run dev一切都很好,没有错误,但是当我开始构建时,npm run build我有一个错误,它说。
Type error: Module '"react-leaflet"' has no exported member 'useEventHandlers'.
1 | import { useMemo, useCallback, useState } from 'react'
> 2 | import { useMap, useMapEvent, useEventHandlers, MapContainer } from 'react-leaflet'
| ^
3 |
4 | // Classes used by Leaflet to position controls
5 | const POSITION_CLASSES = {
info - Checking validity of types .
Run Code Online (Sandbox Code Playgroud)
这是我的package.json文件。
{
"name": "spot-nearby",
"version": "0.1.0",
"private": true, …Run Code Online (Sandbox Code Playgroud) reactjs ×4
javascript ×2
next.js ×2
node.js ×2
rust ×2
arrays ×1
bootstrap-4 ×1
css ×1
dependencies ×1
npm ×1
package.json ×1
sapper ×1
struct ×1
svelte ×1
typescript ×1
yarnpkg ×1