jackieli123723 / jackieli123723.github.io

✅lilidong 个人博客
9 stars 0 forks source link

记录一次ssr脚手架升级的bug修复 #41

Open jackieli123723 opened 6 years ago

jackieli123723 commented 6 years ago

vue-ssr脚手架升级过程

由于官方的extract-text-webpack-plugin^3.0.2 升级导致了webpack^2.2.1 打包报错

//extract-text-webpack-plugin 没升级前这样 是可用的 执行npm run build 不报错下面的内容
"extract-text-webpack-plugin": "^3.0.2",
    "webpack": "^2.2.1",

报错信息

Administrator@lenovo-PC MINGW64 /e/jackieli/longyuanWork/ssr-vue-longyuan-store-front-mobile (master)
$ npm run build

> vue-ssr-mall-mobile@1.0.0 build E:\jackieli\longyuanWork\ssr-vue-longyuan-store-front-mobile
> rimraf dist && npm run build:client && npm run build:server

> vue-ssr-mall-mobile@1.0.0 build:client E:\jackieli\longyuanWork\ssr-vue-longyuan-store-front-mobile
> cross-env NODE_ENV=production webpack --config ./build/webpack.client.config.js --hide-modules

▄    ▄▄ ,--------,      ,----------------.
▄░░░░▄▄ │▗▝ ▞ ▝ ˄---˄  / 打包进度... 12.88 % |
  ▄▄▄▄    ▄▄▄▄    ▄▄▄▄    ▄▄▄▄    ▄▄▄▄ ,--------,      ,----------------.
░░▄▄▄▄░░░░▄▄▄▄░░░░▄▄▄▄░░░░▄▄▄▄░░░░▄▄▄▄ │▗▝ ▞ ▝ ˄---˄  / 打包进度... 76.00 % |
░░▄▄▄▄░░░░▄▄▄▄░░░░▄▄▄▄░░░░▄▄▄▄░░░░▄▄▄▄~│ ▞  ▞ ❬.◕‿‿◕.❭------------------’
░░▄▄▄▄░░░░▄▄▄▄░░░░▄▄▄▄░░░░▄▄▄▄░░░░▄▄▄▄ `w-w---- w w
░░▄▄▄▄░░░░▄▄▄▄░░░░▄▄▄▄░░░░▄▄▄▄░░░░▄▄▄▄
basic chunk optimization
E:\jackieli\longyuanWork\ssr-vue-longyuan-store-front-mobile\node_modules\.3.0.2@extract-text-webpack-plugin\dist\index.js:188
            chunk.sortModules();
                  ^

TypeError: chunk.sortModules is not a function
    at E:\jackieli\longyuanWork\ssr-vue-longyuan-store-front-mobile\node_modules\.3.0.2@extract-text-webpack-plugin\dist\index.js:188:19
    at E:\jackieli\longyuanWork\ssr-vue-longyuan-store-front-mobile\node_modules\.2.6.0@async\dist\async.js:3096:16
    at eachOfArrayLike (E:\jackieli\longyuanWork\ssr-vue-longyuan-store-front-mobile\node_modules\.2.6.0@async\dist\async.js:1055:9)
    at eachOf (E:\jackieli\longyuanWork\ssr-vue-longyuan-store-front-mobile\node_modules\.2.6.0@async\dist\async.js:1103:5)
    at Object.eachLimit (E:\jackieli\longyuanWork\ssr-vue-longyuan-store-front-mobile\node_modules\.2.6.0@async\dist\async.js:3158:5)
    at Compilation.<anonymous> (E:\jackieli\longyuanWork\ssr-vue-longyuan-store-front-mobile\node_modules\.3.0.2@extract-text-webpack-plugin\dist\index.js:184:27)
    at Compilation.applyPluginsAsyncSeries (E:\jackieli\longyuanWork\ssr-vue-longyuan-store-front-mobile\node_modules\.0.2.8@tapable\lib\Tapable.js:206:13)
    at Compilation.seal (E:\jackieli\longyuanWork\ssr-vue-longyuan-store-front-mobile\node_modules\.2.7.0@webpack\lib\Compilation.js:579:8)
    at E:\jackieli\longyuanWork\ssr-vue-longyuan-store-front-mobile\node_modules\.2.7.0@webpack\lib\Compiler.js:493:16
    at E:\jackieli\longyuanWork\ssr-vue-longyuan-store-front-mobile\node_modules\.0.2.8@tapable\lib\Tapable.js:289:11
    at _addModuleChain (E:\jackieli\longyuanWork\ssr-vue-longyuan-store-front-mobile\node_modules\.2.7.0@webpack\lib\Compilation.js:481:11)
    at processModuleDependencies.err (E:\jackieli\longyuanWork\ssr-vue-longyuan-store-front-mobile\node_modules\.2.7.0@webpack\lib\Compilation.js:452:13)
    at _combinedTickCallback (internal/process/next_tick.js:95:7)
    at process._tickCallback (internal/process/next_tick.js:161:9)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! vue-ssr-mall-mobile@1.0.0 build:client: `cross-env NODE_ENV=production webpack --config ./build/webpack.client.config.js --hide-modules`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the vue-ssr-mall-mobile@1.0.0 build:client script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Administrator\AppData\Roaming\npm-cache\_logs\2017-12-27T07_36_09_760Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! vue-ssr-mall-mobile@1.0.0 build: `rimraf dist && npm run build:client && npm run build:server`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the vue-ssr-mall-mobile@1.0.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Administrator\AppData\Roaming\npm-cache\_logs\2017-12-27T07_36_09_815Z-debug.log

然后去官方看文档和删除npm 安装目录

//然后 cnpm install
出现一句

peerDependencies WARNING [extract-text-webpack-plugin@3.0.2] in E:\jackieli\longyuanWork\ssr-vue-longyuan-store-front-mobile\node_modules\.3.0.2@extract-text-webpack-plugin requires a peer of webpack@^3.1.0 but webpack@2.7.0 was installed

恍然大悟升级package.json 重新安装 执行 npm run build >>>ok!!!

"extract-text-webpack-plugin": "^3.0.2",
    "webpack": "^3.1.0",