知道该怎么做吗?除了尝试它所说的“npm install”(产生完全相同的错误......)和谷歌搜索之外,我没有任何其他东西,并且在stackoverflow中似乎没有答案。
感谢您的帮助,因为我是 npm 的初学者,并且月复一月地过度沮丧......
这是错误中提到的“完整日志”:
0 info it worked if it ends with ok
1 verbose cli [
1 verbose cli 'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli 'C:\\Users\\Daniel\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli 'install'
1 verbose cli ]
2 info using npm@6.14.9
3 info using node@v14.15.2
4 verbose npm-session 0f25ee095e558051
5 silly install runPreinstallTopLevelLifecycles
6 silly preinstall react-player@0.1.0
7 info lifecycle react-player@0.1.0~preinstall: react-player@0.1.0
8 silly install loadCurrentTree
9 silly install readLocalPackageData
10 timing stage:loadCurrentTree Completed in 4777ms
11 silly install loadIdealTree
12 …Run Code Online (Sandbox Code Playgroud) 突然间,几乎所有已安装的模块都出现此错误。
“C:/.../node_modules/.vite/react.js”的 Sourcemap 指向缺失的源文件 “C:/.../node_modules/.vite/axios.js”的 Sourcemap 指向缺失的源文件 Sourcemap “C:/.../node_modules/.vite/react-dom.js”指向缺少的源文件 “C:/.../node_modules/.vite//react_jsx-dev-runtime.js”的 Sourcemap 指向缺少源文件
包.json:
{
"name": "ic-logistic",
"version": "0.0.0",
"proxy": "http://localhost:8080/",
"private": true,
"scripts": {
"dev": "vite",
"build": "vite build",
"serve": "vite preview"
},
"dependencies": {
"axios": "^0.24.0",
"dotenv": "^10.0.0",
"mapbox-gl": "^2.5.0",
"react": "^17.0.0",
"react-dom": "^17.0.0",
"react-map-gl": "^6.1.17",
"react-redux": "^7.2.5",
"react-router-dom": "^5.3.0",
"redux": "^4.1.1",
"redux-devtools-extension": "^2.13.9",
"sass": "^1.42.1"
},
"devDependencies": {
"@vitejs/plugin-react": "^1.0.0",
"vite": "^2.6.0"
}
}
Run Code Online (Sandbox Code Playgroud) 我正在尝试按照本教程从 React 应用程序设置 Azure 身份验证: https://learn.microsoft.com/en-us/azure/active-directory/develop/tutorial-v2-react
设置 Azure 并运行它后,我收到此错误:ClientConfigurationError: url_parse_error: URL 无法解析为适当的段。给定错误:给定 url 字符串:common/
下面是配置文件“authConfig.js”。我不知道我做错了什么,因为我是第一次这样做,而且我不理解错误消息,除了我尝试过的更改之外,我也没有在文档中找到任何相关内容权限字符串。
/*
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License.
*/
import { LogLevel } from "@azure/msal-browser";
/**
* Configuration object to be passed to MSAL instance on creation.
* For a full list of MSAL.js configuration parameters, visit:
* https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/lib/msal-browser/docs/configuration.md
*/
export const msalConfig = {
auth: {
clientId: "912fcdde-6306-4397-96ec-d7e24418d206",
// authority: "bde20525-a858-4726-a4c7-48bd8239499f",
// authority: "emtechdemo07052021.onmicrosoft.com",
authority: "common",
redirectUri: …Run Code Online (Sandbox Code Playgroud) 这是在一个反应应用程序上,可能出了什么问题?每次都会附加一个新的 svg,而不是现有的更新...我不确定我应该添加哪些其他详细信息,我已经包含了您可能需要帮助我的所有信息,如果有任何信息,请告诉我否则我应该补充一下。谢谢。

这是我的组件,我通过道具传递数据。
export const FourDirectionsTimeChart = ({data}) => {
useEffect(() => {
const width = document.getElementById("container").clientWidth;
const height = document.getElementById("container").clientHeight;
const R = (width + height) / 8;
const CX = width / 2;
const CY = height / 2;
const smallR = R * 0.1;
const circleColor = "bisque";
const itemColor = "#3F4200";
let svg = d3.select("#container")
.append("svg")
.attr("preserveAspectRatio", "xMinYMin meet")
.attr("viewBox", `0 0 ${width} ${height}`)
let mainCircle = svg.append("circle")
.attr("fill", circleColor)
.attr("r", R)
.attr("cx", CX)
.attr("cy", CY); …Run Code Online (Sandbox Code Playgroud) 我正在按照官方文档中的步骤安装该服务:https ://mswjs.io/docs/getting-started/install
这段代码:
if (process.env.NODE_ENV === 'development') {
const { worker } = require('../tests/mocks/browser');
worker.start();
}
Uncaught ReferenceError: require is not defined
Run Code Online (Sandbox Code Playgroud)
我已经使用 Vite 设置了该项目。解决这个问题的正确方法是什么。