为什么webpack不能与UglifyJs一起运行?

时间:2017-07-06 11:00:40

标签: node.js webpack

节点版本:6.11.0 npm版本:3.10.10

当尝试运行webpack时,出现了以下错误:

ERROR in app.js from UglifyJs
TypeError: Cannot read property 'reset' of undefined
    at /home/app/myapp/client/node_modules/uglifyjs-webpack-plugin/dist/index.js:99:22
    at /home/app/myapp/client/node_modules/uglifyjs-webpack-plugin/dist/index.js:231:9
    at Array.forEach (native)
    at Compilation.<anonymous> (/home/app/myapp/client/node_modules/uglifyjs-webpack-plugin/dist/index.js:54:19)
    at Compilation.applyPluginsAsyncSeries (/home/app/myapp/client/node_modules/tapable/lib/Tapable.js:142:13)
    at self.applyPluginsAsync.err (/home/app/myapp/client/node_modules/webpack/lib/Compilation.js:626:10)
    at Compilation.applyPluginsAsyncSeries (/home/app/myapp/client/node_modules/tapable/lib/Tapable.js:131:46)
    at sealPart2 (/home/app/myapp/client/node_modules/webpack/lib/Compilation.js:622:9)
    at Compilation.applyPluginsAsyncSeries (/home/app/myapp/client/node_modules/tapable/lib/Tapable.js:131:46)
    at Compilation.seal (/home/app/myapp/client/node_modules/webpack/lib/Compilation.js:570:8)
    at /home/app/myapp/client/node_modules/webpack/lib/Compiler.js:474:16
    at /home/app/myapp/client/node_modules/tapable/lib/Tapable.js:225:11
    at _addModuleChain (/home/app/myapp/client/node_modules/webpack/lib/Compilation.js:472:11)
    at processModuleDependencies.err (/home/app/myapp/client/node_modules/webpack/lib/Compilation.js:443:13)
    at _combinedTickCallback (internal/process/next_tick.js:73:7)
    at process._tickCallback (internal/process/next_tick.js:104:9)

npm ERR! Linux 3.10.0-514.el7.x86_64
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "--prefix" "client" "run" "webpack-build"
npm ERR! node v6.11.0
npm ERR! npm  v3.10.10
npm ERR! code ELIFECYCLE
npm ERR! @ webpack-build: `webpack -p --config webpack.config.js`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the @ webpack-build script 'webpack -p --config webpack.config.js'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the  package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     webpack -p --config webpack.config.js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /home/app/myapp/npm-debug.log

我确定安装了这个:

npm install uglify-js@^2.8.0

但也不适用于UglifyJs。是由于webpack版本还是别的什么?

顺便说一句,操作系统是Ubuntu 16.04。

加成

npm ls uglify-js
/home/app/myapp
`-- uglify-js@2.8.29

0 个答案:

没有答案