[英]Installing react router but does not update package.json file
Installing react-router-dom
, after showing to many warning message and it does not update the package.json
file. 在显示很多警告消息后安装react-router-dom
,它不会更新package.json
文件。 Package.json
file in side dependencies object block dos not show reac-router-dom
version information. 侧面依赖项对象块中的Package.json
文件不显示reac-router-dom
版本信息。
React Router: 反应路由器:
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 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"
}
}
You need to put --save
or -S
as an option to npm install like this: npm install -S react-router-dom
. 您需要将--save
或-S
作为这样的npm install选项: npm install -S react-router-dom
。 Then your telling npm to add it to package.json. 然后,您告诉npm将其添加到package.json。 Or if you want to save it as a dev dependency you add a -D
或者,如果要将其另存为开发依赖项,则可以添加-D
Edit 编辑
According to this answer: https://stackoverflow.com/a/44441625/5997891 , and the comment below, from npm
version 5 , the npm install
command saves packages by default. 根据以下答案: https : //stackoverflow.com/a/44441625/5997891以及以下注释,从npm
版本5开始, npm install
命令默认保存软件包。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.