运行npm后,我-保存react-router-dom我遇到了错误

时间:2018-08-28 08:48:40

标签: reactjs npm

运行react-router-dom命令后出现以下错误 该如何解决?

  

./ node_modules / create-react-context / lib / implementation.js找不到模块:无法在'C:\ xampp \ htdocs \ learn-router \ node_modules \ create-react-context \中解析'react' lib'

2 个答案:

答案 0 :(得分:1)

您必须先安装react,然后再安装react-router-dom软件包,

尝试一下:

$ echo '#!/bin/python' > 1
$ file 1
1: a /bin/python script, ASCII text executable

$ echo '#!/bin/sh' > 2
$ file 2
2: POSIX shell script, ASCII text executable

$ echo '#!/usr/bin/env python' > 3
$ file 3
3: Python script, ASCII text executable

$ echo 'int main() { return 0; } ' | gcc -xc -o4 -
$ file 4
4: ELF 64-bit LSB pie executable x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 3.2.0, BuildID[sha1]=d2f65ad2fe7b73bd5f4acc9fc9da25f748fe9915, not stripped

答案 1 :(得分:0)

react-router-dom直接添加到dependencies文件的package.json列表中。

"react-router-dom": "^4.3.1",

然后在项目根目录中运行以下命令。

npm install

enter image description here