简体   繁体   English

如何修复安装“react-router-dom”时出错?

[英]How to fix Error in installing "react-router-dom?

I got error while installing the react-router-dom.安装 react-router-dom 时出错。
错误图片

D:\react\routeingreact>npm i react-router-dom
npm ERR! Cannot read property 'match' of undefined

npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\5442\AppData\Roaming\npm-cache\_logs\2020-04-01T05_06_17_337Z-debug.log

You are attempting to install the wrong package.您正在尝试安装错误的软件包。 There is no package router-react-dom .没有包router-react-dom You are looking for react-router-dom .您正在寻找react-router-dom You mixed up the order of the words react and router in your install command.您在安装命令中混淆了单词reactrouter的顺序。 The correct install command would be:正确的安装命令是:

npm install react-router-dom

I'd recommend reviewing the getting started guide for react-router-dom also.我还建议您查看react-router-dom 入门指南

Hopefully that helps!希望这有帮助!

You need to delete one file and one directory:您需要删除一个文件和一个目录:

  • package-lock.json包-lock.json
  • node_modules节点模块

That should you get you back on track你应该让你回到正轨

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM