Error in ./~/@remix-run/router/dist/router.cjs.js
Module parse failed: /home/sharib/Desktop/Full Stack Developer Tutorial/MERN Stack/loginForm/loginform/node_modules/@remix-run/router/dist/router.cjs.js Unexpected token (1073:8)
You may need an appropriate loader to handle this file type.
SyntaxError: Unexpected token (1073:8)
@ ./~/react-router-dom/dist/umd/react-router-dom.development.js 12:125-153
/~/@ReMix-Run/Router/dist/router.cjs.js模块分析失败:/HOME/sharib/Desktop/Full Stack Developer Tutorial/MERN Stack/loginForm/loginform/node_modules/@remix-run/router/dist/router.cjs.js意外令牌(1073:8)您可能需要适当的加载器来处理此文件类型。语法错误:意外标记(1073:8)@./~/react-router-dom/dist/umd/react-router-dom.development.js 12:125-153
nodejs version : 16.17.0
NodeJS版本:16.17.0
npm version : 8.19.2
NPM版本:8.19.2
react-router version : 6.4.1
Reaction-路由器版本:6.4.1
My App.js :-
My App.js:-
import React, { Component } from "react";
import Navbar from "./Components/Navbar";
import Home from "./Components/Home";
import SignUp from "./Components/SignUp";
import { BrowserRouter, Routes, Route } from "react-router-dom";
import "./App.css";
const App =()=> {
return (
<BrowserRouter>
<Routes>
<Route path="/" element={<Navbar />}>
<Route index element={<Home />} />
<Route path="SignUp" element={< SignUp />} />
</Route>
</Routes>
</BrowserRouter>
);
};
export default App;
更多回答
Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking.
请澄清您的具体问题或提供更多详细信息,以突出您的确切需求。按照目前的写法,很难准确地说出你在问什么。
优秀答案推荐
for me the issue was in react-scripts
dunno why but it was 0.9.5 so i changed it to 5 .0 .1 then run npm i react-scripts and it worked
对我来说,问题出在反应脚本中,不知道为什么,但它是0.9.5,所以我将其更改为5.0.1,然后运行NPM,我反应脚本,它起作用了
Running npm audit fix --force
resolved this issue for me.
运行NPM审计修复--force为我解决了这个问题。
I fixes the same issue by using the previous version of react-route-dom package. So, instead of using [email protected]
, simply get the older version:
我通过使用以前版本的REACTIVE-ROUTE-DOM包修复了相同的问题。因此,不要使用[受保护的电子邮件],只需获得较旧的版本:
npm install [email protected]
Make sure that package.json
took over that version after installation.
确保Package.json在安装后接管该版本。
This fixes your problem.
The version you are using is not appropriate for this purpose. Change the version of the "react-router-dom": "^6.15.1"
这就解决了您的问题。您正在使用的版本不适用于此目的。更改“REACT-ROUTER-DOM”的版本:“^6.15.1”
to: "react-router-dom": "^6.0.1"
收件人:“REACT-ROUTER-DOM”:“^6.0.1”
npm install [email protected]
更多回答
[email protected] is causing the issue: Cannot find module "@remix-run/router". Can someone explain this bit further...?
[受保护的电子邮件]导致此问题:找不到模块“@ReMix-Run/Router”。有没有人能再解释一下……?
我是一名优秀的程序员,十分优秀!