webpack-dev-server fsevents@1.2.13 总是会调用全局的node-gyp 如何解决
时间: 2024-02-17 14:59:45 浏览: 131
这个问题可能是因为你的系统中没有正确安装或配置node-gyp导致的。你可以尝试以下几个解决方法:
1. 确保你已经正确安装了node-gyp,可以在终端中输入以下命令来验证:
```
node-gyp -v
```
如果提示“command not found”,说明需要安装node-gyp,可以使用以下命令安装:
```
npm install -g node-gyp
```
2. 确保你的系统已经正确配置了node-gyp,可以输入以下命令来验证:
```
node-gyp configure
```
如果提示错误,可以尝试重新安装node-gyp或者检查配置是否正确。
3. 如果以上方法都无效,可以尝试升级fsevents模块到最新版本,使用以下命令:
```
npm install fsevents@latest
```
如果还是不行,可以尝试删除node_modules目录并重新安装依赖:
```
rm -rf node_modules
npm install
```
希望这些解决方法能够帮助到你!
相关问题
yarn add opencv-js yarn add v1.22.19 warning package.json: "dependencies" has dependency "css-loader" with range "^0.28.1" that collides with a dependency in "devDependencies" of the same name with version "^0.28.0" warning package.json: "dependencies" has dependency "webpack" with range "^2.5.0" that collides with a dependency in "devDependencies" of the same name with version "^2.2.1" warning package.json: "dependencies" has dependency "webpack-dev-server" with range "^2.4.5" that collides with a dependency in "devDependencies" of the same name with version "^2.3.0" warning package-lock.json found. Your project contains lock files generated by tools other than Yarn. It is advised not to mix package managers in order to avoid resolution inconsistencies caused by unsynchronized lock files. To clear this warning, remove package-lock.json. warning arc@0.1.0: "dependencies" has dependency "css-loader" with range "^0.28.1" that collides with a dependency in "devDependencies" of the same name with version "^0.28.0" warning arc@0.1.0: "dependencies" has dependency "webpack" with range "^2.5.0" that collides with a dependency in "devDependencies" of the same name with version "^2.2.1" warning arc@0.1.0: "dependencies" has dependency "webpack-dev-server" with range "^2.4.5" that collides with a dependency in "devDependencies" of the same name with version "^2.3.0" [1/4] Resolving packages... warning dragact > jest > jest-cli > jest-haste-map > sane > fsevents@1.2.13: The v1 package contains DANGEROUS / INSECURE binaries. Upgrade to safe fsevents v2 warning webpack > watchpack > watchpack-chokidar2 > chokidar > fsevents@1.2.13: The v1 package contains DANGEROUS / INSECURE binaries. Upgrade to safe fsevents v2 warning @kadira/storybook > webpack > watchpack > chokidar > fsevents@1.2.13: The v1 package contains DANGEROUS / INSECURE binaries. Upgrade to safe fsevents v2 error Received malformed response from registry for "opencv-js". The registry may be down. info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command
这个错误提示是因为npm仓库可能出现了一些问题,导致无法下载opencv-js包。您可以尝试等待一段时间后再次运行命令,或者尝试使用其他的npm源来下载opencv-js包。您可以使用以下命令来尝试更改npm源:
```
npm config set registry https://registry.npm.taobao.org
```
然后再次运行以下命令来安装opencv-js包:
```
yarn add opencv-js
```
如果还是无法下载,您可以尝试使用其他的npm源,例如:
```
npm config set registry https://registry.npmjs.org/
```
然后再次运行以下命令来安装opencv-js包:
```
yarn add opencv-js
```
希望这些方法能够帮助您解决问题。
TypeError: Non-string provided as watch path: false at FSWatcher.add (E:\电脑桌面\vue-admin-template-master\node_modules\webpack-dev-server\node_modules\chokidar\index.js:604:11) at Object.exports.watch (E:\电脑桌面\vue-admin-template-master\node_modules\webpack-dev-server\node_modules\chokidar\index.js:746:33) at Server._watch (E:\电脑桌面\vue-admin-template-master\node_modules\webpack-dev-server\lib\Server.js:1014:30) at Server.setupWatchStaticFeature (E:\电脑桌面\vue-admin-template-master\node_modules\webpack-dev-server\lib\Server.js:448:12) at Object.watchContentBase (E:\电脑桌面\vue-admin-template-master\node_modules\webpack-dev-server\lib\Server.js:511:14) at E:\电脑桌面\vue-admin-template-master\node_modules\webpack-dev-server\lib\Server.js:584:24 at Array.forEach (<anonymous>) at Server.setupFeatures (E:\电脑桌面\vue-admin-template-master\node_modules\webpack-dev-server\lib\Server.js:583:49) at new Server (E:\电脑桌面\vue-admin-template-master\node_modules\webpack-dev-server\lib\Server.js:126:10) at serve (E:\电脑桌面\vue-admin-template-master\node_modules\@vue\cli-service\lib\commands\serve.js:172:20) at processTicksAndRejections (node:internal/process/task_queues:96:5)
这个错误提示的意思是,webpack-dev-server监听的文件路径不是字符串类型,而是一个布尔类型的值false,导致出现了类型错误。
通常情况下,webpack-dev-server会监听指定目录下的文件变化,并自动进行热重载。您可以检查一下您的webpack-dev-server配置文件中,是否正确指定了需要监听的文件目录。
如果您使用的是vue-cli脚手架工具创建的vue项目,通常情况下,webpack-dev-server的配置文件为vue.config.js,您可以在该文件中查找并确认是否正确指定了需要监听的文件目录。
另外,您可以尝试升级一下webpack-dev-server的版本,或者重新安装一下webpack-dev-server模块,以解决可能的版本兼容性问题。
阅读全文