尝试使用npm等进行反应,我经常收到以下类型的警告:
Trying to get into react, using npm and such, and I often get these types of warnings:
> npm install axios redux react-redux redux-thunk react-router-dom validator redux-form npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.8 (node_modules\chokidar\node_modules\fsevents): npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.8: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"}) npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.8 (node_modules\jest-haste-map\node_modules\fsevents): npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.8: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"}) npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.0.6 (node_modules\fsevents): npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.0.6: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"}) + redux-thunk@2.3.0 + validator@10.11.0 + axios@0.18.0 + react-router-dom@5.0.0 + redux@4.0.1 + react-redux@7.0.2 + redux-form@8.2.0 added 30 packages from 100 contributors and audited 878734 packages in 23.247s found 0 vulnerabilities显然我可以忽略它们,但是我很好奇是否有办法不得到这些警告?以某种方式配置npm?在package.json中添加一些内容?
Apparently I can just ignore them, but I'm just curious if there's a way to not get these warnings? Configure npm somehow? Adding something to package.json? A flag somewhere?
推荐答案由于操作系统的缘故,这是一个警告。 fsevents在mac os环境中运行,但在Windows中,它作为可选的依赖项起作用,这是所有警告均不是错误之后的原因。 可以使用 github/paulmillr/chokidar 代替fsevents。
It's a warning, due to the operating system. fsevents run on mac os environment but in windows, it works as optional dependencies that are the reason behind your warning after all its not an error. you can use github/paulmillr/chokidar instead of fsevents.
问题与 shrinkwrap或package-lock.json有关,在每次执行软件包管理器后,该问题都会持续存在。
The problem relates to the "shrinkwrap" or package-lock.json which gets persisted after every package manager execution. Subsequent attempts keep failing as this file is referenced instead of package.json.
将这些选项添加到npm install命令中应该会允许软件包再次安装。
Adding these options to the npm install command should allow packages to install again.
--no-optional argument will prevent optional dependencies from being installed. --no-shrinkwrap argument, which will ignore an available package lock or shrinkwrap file and use the package.json instead。
-no-package-lock参数将阻止npm从创建package-lock.json文件开始。 完整的命令如下所示:
--no-package-lock argument will prevent npm from creating a package-lock.json file. The complete command looks like this:
npm install --no-optional --no-shrinkwrap --no-package-lock您可以查看以下答案 npm警告notsup跳过可选功能:fsevents@1.0.14不受支持的平台
更多推荐
有什么方法可以避免fsevents警告?
发布评论