webpack安装异常

webpack中文指南:https://zhaoda.net/webpack-handbook/index.html

今天中午,我用   cnpm install   重新下载了一下项目的依赖,爆了一个错误如下:

peerDependencies link ajv@5.5.2 in D:work-span	ravelTravel
ode_modules\_ajv-keywords@2.1.1@ajv-keywords unmet with D:work-span	ravelTravel
ode_modulesajv(6.6.2)
peerDependencies WARNING webpack-dev-server@^3.1.14 requires a peer of webpack@^4.0.0 but webpack@3.12.0 was installed
peerDependencies WARNING webpack-cli@^3.1.2 requires a peer of webpack@^4.x.x but webpack@3.12.0 was installed
peerDependencies WARNING webpack-dev-server@3.1.14 › webpack-dev-middleware@3.4.0 requires a peer of webpack@^4.0.0 but webpack@3.12.0 was installed
deprecate autoprefixer@7.2.6 › browserslist@^2.11.3 Browserslist 2 could fail on reading Browserslist >3.0 config used in other tools.
deprecate css-loader@0.28.11 › cssnano@3.10.0 › autoprefixer@6.7.7 › browserslist@^1.7.6 Browserslist 2
could fail on reading Browserslist >3.0 config used in other tools.
deprecate eslint@4.19.1 › file-entry-cache@2.0.0 › flat-cache@1.3.4 › circular-json@^0.3.1 CircularJSON
is in maintenance only, flatted is its successor.
deprecate webpack-bundle-analyzer@2.13.1 › bfj-node4@^5.2.0 Switch to the `bfj` package for fixes and new features!
Recently updated (since 2018-12-18): 9 packages (detail see file D:work-span	ravelTravel
ode_modules.recently_updates.txt)
√ All packages installed (928 packages installed from npm registry, used 38s(network 37s), speed 529.19
kB/s, json 802(1.72MB), tarball 17.22MB)

我仔细查了一下,原来是webpack-dev-server需要webpack  4.0.0以上版本的支持,但是我的webpack才是3.12.0版本,版本不够。

果断拆卸

//全局拆卸webpack  

npm uninstall webpack -g

然后

//全局安装webpack
$ npm install webpack -g


//因为webpack版本问题最好安装现目前的稳定版
$ npm install webpack-dev-server@2.9.7 --save-dev

显示如下

难道又出错了。网上查看一番。我去,原来不是我的锅;

出现这样的原因是: fsevent是mac osx系统的,在win或者Linux下使用了 所以会有警告,忽略即可。

原文地址:https://www.cnblogs.com/clwydjgs/p/10174622.html