运行webpack时出现UglifyJs错误

系统:Ubuntu 16.04
Node版本: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
npm ls uglify-js
/home/app/myapp
`-- uglify-js@2.8.29

这和webpack的版本会有关系吗?webpack的版本是3.1.0

阅读 5k
1 个回答
撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题