安装react router dom
,向许多人显示警告消息后,它不会更新包。json文件<代码>包。side dependencies对象块dos中的json
文件不显示reac路由器dom
版本信息。
反应路由器:
npm i react-router-dom
npm WARN saveError ENOENT: no such file or directory, open 'D:\Linux\IDE\All-Workspace\JavaScript-Workspace\package.json'
npm WARN enoent ENOENT: no such file or directory, open 'D:\Linux\IDE\All-Workspace\JavaScript-Workspace\package.json'
npm WARN @webpack-contrib/config-loader@1.2.1 requires a peer of webpack@^4.3.0 but none is installed. You must install peer dependencies yourself.
npm WARN @webpack-contrib/schema-utils@1.0.0-beta.0 requires a peer of webpack@^3.0.0 || ^4.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN react-router@4.3.1 requires a peer of react@>=15 but none is installed. You must install peer dependencies yourself.
tpm WARN uglifyjs-webpack-plugin@1.3.0 requires a peer of webpack@^2.0.0 || ^3.0.0 || ^4.0.0 but none is installed. You must install peer depealled. You must install peer dependencies yourself.
npm WARN uglifyjs-webpack-plugin@1.3.0 requires a peer of webpack@^2.0.0 installed. You must install peer dependencies yourself.
|pm WARN webpack-command@0.4.1 requires a peer of webpack@^4.4.0 but none is installed. You must install peer dependencies yourself.| ^3.0.0 || ^4.0.0 but none is installed. You must install peer dependenc installed. You must install peer dependencies yourself.
ipm WARN JavaScript-Workspace No description
es yourself.
npm WARN webpack-cli@3.1.0 requires a peer of webpack@^4.x.x but none is
ipm WARN JavaScript-Workspace No license field.
nstalled. You must install peer dependencies yourself. les\fsevents):
npm WARN webpack-command@0.4.1 requires a peer of webpack@^4.4.0 but noneevents@1.2.4: wanted {"os":"darwin","arch":"any"} (current: {"os":"wiis installed. You must install peer dependencies yourself.
npm WARN react-router-dom@4.3.1 requires a peer of react@>=15 but none isnpm WARN webpack-command@0.4.1 requires a peer of webpack@^4.4.0 but none
is installed. You must install pe
er dependencies yourself.
npm WARN react-router-dom@4.3.1 requires a peer of react@>=15 but none is
installed. You must install peer
dependencies yourself.
npm WARN webpack-command@0.4.1 requires a peer of webpack@^4.4.0 but none dep: is installed. You must install peer dependencies yourself.
npm WARN react-router-dom@4.3.1 requires a peer of react@>=15 but none is installed. You must install peer dependencies yourself.
npm WARN JavaScript-Workspace No descriptionnpm WARN JavaScript-Workspace No repository field.
npm WARN JavaScript-Workspace No README data
npm WARN JavaScript-Workspace No license field.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.4 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.4: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
+ react-router-dom@4.3.1updated 1 package and audited 11195 packages in 13.378sfound 0 vulnerabilities
Package.json
{
"name": "lyricfinder_react",
"version": "0.1.0",
"private": true,
"dependencies": {
"react": "^16.4.2",
"react-dom": "^16.4.2",
"react-scripts": "1.1.5"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test --env=jsdom",
"eject": "react-scripts eject"
}
}
您需要将--sa
或-S
作为npm安装的选项,如下所示:npm安装-S react-router-dom
。然后你告诉npm将其添加到package.json.或者如果你想将其保存为开发依赖项,你可以添加一个-D
编辑
根据这个答案:https://stackoverflow.com/a/44441625/5997891,以及下面的注释,从npm
版本5中,npm安装
命令默认保存包。
问题内容: 我正在使用react-router开发一个React应用程序。我有一个项目页面,其URL如下: 当项目组件加载时,我从componentDidMount事件触发了对该项目的数据请求。我现在遇到一个问题,如果我直接在两个项目之间切换,那么只有id会这样改变… componentDidMount不会再次触发,因此不会刷新数据。我是否应该使用另一个生命周期事件来触发我的数据请求,或者使用其他
我正在尝试运行composer更新,或者如果我试图为我的站点安装任何软件包,它会挂起,这样说 但如果我尝试作曲家安装它的工作与 我正在使用带有流浪者和虚拟箱的拉威尔家园 问题是什么?如何解决
在标记为副本之前,请仔细阅读此内容,我向您保证,我已经阅读并尝试了每个人在stackoverflow和github上提出的关于此问题的所有建议。 我在我的应用程序中有一条路线,如下所示; route rendering呈现打开用户角色的组件,并基于该角色惰性加载正确的Routes组件,Routes组件呈现主页的开关。简化后,如下所示。 然后是路由组件 因此,问题是每当用户从/导航到/秒等...应用
我意识到以前有人问过我这个问题,请容忍我,因为我还在学习这个问题。我想我已经尝试了所有的解决方案,但是没有运气。 问题是:当重定向到时,它没有呈现预期的组件() 我已经实现了一个,如下所示; privaterout.js 这就是我使用它的地方; index.js 在这个问题中要补充几点: 我确认重定向确实发生在(我通过将
问题内容: 在此请忍受,因为这个问题与我使用React,Redux或react- redux的第一个测试应用有关。Docs使我步入正轨,并且我有一个可以正常工作的模拟银行应用程序。我的状态对象大致如下所示: 我只有两个动作: 1. CHANGE_HASH(如网址哈希中所示)。此操作始终按预期工作,而reducer所做的只是更新state.activePageId(是的,我正在克隆状态对象而不是对其
我已经设置了react路由器和一个组件来呈现一些页面组件。我的所有组件都呈现相同的布局(目前,稍后将是参数化的)。我的页面组件将内容“注入”到布局中,因此我不能让布局组件包装我的外部开关组件。它必须用作页面组件中的子级。 即使最终的html呈现与布局框架相同(它仅在布局的插槽部分内不同),react也会卸载并重新装载整个布局树。 我能理解重新渲染整棵树的反应。React会看到不同的顶部组件(每个位