执行webpack -v报错
来源:3-4 npm和webpack的初始化
慕数据4154996
2019-02-08
系统是win10
执行npm install webpack -g后,显示如下:
npm WARN engine webpack@4.29.3: wanted: {"node":">=6.11.5"} (current: {"node":"4 .4.7","npm":"2.15.8"})
npm WARN engine tapable@1.1.1: wanted: {"node":">=6"} (current: {"node":"4.4.7", "npm":"2.15.8"})
npm WARN engine terser-webpack-plugin@1.2.2: wanted: {"node":">= 6.9.0"} (curren t: {"node":"4.4.7","npm":"2.15.8"})
npm WARN engine chrome-trace-event@1.0.0: wanted: {"node":">=6.0"} (current: {"n ode":"4.4.7","npm":"2.15.8"})
npm WARN engine enhanced-resolve@4.1.0: wanted: {"node":">=6.9.0"} (current: {"n ode":"4.4.7","npm":"2.15.8"})
npm WARN optional dep failed, continuing fsevents@1.2.7
npm WARN engine find-cache-dir@2.0.0: wanted: {"node":">=6"} (current: {"node":" 4.4.7","npm":"2.15.8"})
npm WARN engine terser@3.16.1: wanted: {"node":">=6.0.0"} (current: {"node":"4.4 .7","npm":"2.15.8"})
npm WARN engine atob@2.1.2: wanted: {"node":">= 4.5.0"} (current: {"node":"4.4.7 ","npm":"2.15.8"})
npm WARN engine pkg-dir@3.0.0: wanted: {"node":">=6"} (current: {"node":"4.4.7", "npm":"2.15.8"})
npm WARN engine find-up@3.0.0: wanted: {"node":">=6"} (current: {"node":"4.4.7", "npm":"2.15.8"})
npm WARN engine atob@2.1.2: wanted: {"node":">= 4.5.0"} (current: {"node":"4.4.7 ","npm":"2.15.8"})
npm WARN engine locate-path@3.0.0: wanted: {"node":">=6"} (current: {"node":"4.4 .7","npm":"2.15.8"})
npm WARN engine p-locate@3.0.0: wanted: {"node":">=6"} (current: {"node":"4.4.7" ,"npm":"2.15.8"})
npm WARN engine p-limit@2.1.0: wanted: {"node":">=6"} (current: {"node":"4.4.7", "npm":"2.15.8"})
npm WARN engine p-try@2.0.0: wanted: {"node":">=6"} (current: {"node":"4.4.7","n pm":"2.15.8"})
npm WARN engine punycode@2.1.1: wanted: {"node":">=6"} (current: {"node":"4.4.7" ,"npm":"2.15.8"})
npm WARN engine readable-stream@3.1.1: wanted: {"node":">= 6"} (current: {"node" :"4.4.7","npm":"2.15.8"})
C:\Users\31301\AppData\Roaming\npm\webpack -> C:\Users\31301\AppData\Roaming\npm \node_modules\webpack\bin\webpack.js
webpack@4.29.3 C:\Users\31301\AppData\Roaming\npm\node_modules\webpack
├── json-parse-better-errors@1.0.2
├── @webassemblyjs/helper-module-context@1.7.11
├── loader-runner@2.4.0
├── acorn-dynamic-import@4.0.0
├── schema-utils@1.0.0 (ajv-errors@1.0.1)
├── ajv-keywords@3.3.0
├── acorn@6.1.0
├── eslint-scope@4.0.0 (esrecurse@4.2.1, estraverse@4.2.0)
├── tapable@1.1.1
├── chrome-trace-event@1.0.0 (tslib@1.9.3)
├── mkdirp@0.5.1 (minimist@0.0.8)
├── webpack-sources@1.3.0 (source-list-map@2.0.1, source-map@0.6.1)
├── enhanced-resolve@4.1.0 (graceful-fs@4.1.15)
├── @webassemblyjs/wasm-parser@1.7.11 (@webassemblyjs/helper-api-error@1.7.11, @ webassemblyjs/helper-wasm-bytecode@1.7.11, @webassemblyjs/utf8@1.7.11, @webassem blyjs/leb128@1.7.11, @webassemblyjs/ieee754@1.7.11)
├── memory-fs@0.4.1 (errno@0.1.7, readable-stream@2.3.6)
├── @webassemblyjs/wasm-edit@1.7.11 (@webassemblyjs/helper-buffer@1.7.11, @webas semblyjs/helper-wasm-bytecode@1.7.11, @webassemblyjs/wasm-opt@1.7.11, @webassemb lyjs/helper-wasm-section@1.7.11, @webassemblyjs/wasm-gen@1.7.11, @webassemblyjs/ wast-printer@1.7.11)
├── loader-utils@1.2.3 (emojis-list@2.1.0, big.js@5.2.2, json5@1.0.1)
├── @webassemblyjs/ast@1.7.11 (@webassemblyjs/helper-wasm-bytecode@1.7.11, @weba ssemblyjs/wast-parser@1.7.11)
├── neo-async@2.6.0
├── micromatch@3.1.10 (arr-diff@4.0.0, array-unique@0.3.2, kind-of@6.0.2, object .pick@1.3.0, fragment-cache@0.2.1, nanomatch@1.2.13, to-regex@3.0.2, regex-not@1 .0.2, define-property@2.0.2, extend-shallow@3.0.2, braces@2.3.2, extglob@2.0.4, snapdragon@0.8.2)
├── watchpack@1.6.0 (graceful-fs@4.1.15, chokidar@2.1.0)
├── ajv@6.8.1 (fast-deep-equal@2.0.1, json-schema-traverse@0.4.1, fast-json-stab le-stringify@2.0.0, uri-js@4.2.2)
├── terser-webpack-plugin@1.2.2 (serialize-javascript@1.6.1, source-map@0.6.1, w orker-farm@1.6.0, find-cache-dir@2.0.0, terser@3.16.1, cacache@11.3.2)
└── node-libs-browser@2.2.0 (punycode@1.4.1, tty-browserify@0.0.0, https-browser ify@1.0.0, path-browserify@0.0.0, constants-browserify@1.0.0, os-browserify@0.3. 0, domain-browser@1.2.0, process@0.11.10, querystring-es3@0.2.1, string_decoder@ 1.2.0, stream-browserify@2.0.2, util@0.11.1, events@3.0.0, vm-browserify@0.0.4, timers-browserify@2.0.10, console-browserify@1.1.0, readable-stream@2.3.6, asser t@1.4.1, url@0.11.0, browserify-zlib@0.2.0, stream-http@2.8.3, buffer@4.9.1, cry pto-browserify@3.12.0)
执行npm install webpack@1.15.0 --save-dev后,显示如下:
npm WARN package.json mmall-fe@1.0.0 No README data
npm WARN optional dep failed, continuing fsevents@1.2.7
npm WARN engine atob@2.1.2: wanted: {"node":">= 4.5.0"} (current: {"node":"4.4.7 ","npm":"2.15.8"})
webpack@1.15.0 node_modules\webpack
├── interpret@0.6.6
├── clone@1.0.4
├── tapable@0.1.10
├── async@1.5.2
├── acorn@3.3.0
├── supports-color@3.2.3 (has-flag@1.0.0)
├── mkdirp@0.5.1 (minimist@0.0.8)
├── enhanced-resolve@0.9.1 (graceful-fs@4.1.15, memory-fs@0.2.0)
├── loader-utils@0.2.17 (emojis-list@2.1.0, object-assign@4.1.1, big.js@3.2.0, j son5@0.5.1)
├── memory-fs@0.3.0 (errno@0.1.7, readable-stream@2.3.6)
├── optimist@0.6.1 (wordwrap@0.0.3, minimist@0.0.10)
├── webpack-core@0.6.9 (source-list-map@0.1.8, source-map@0.4.4)
├── node-libs-browser@0.7.0 (path-browserify@0.0.0, punycode@1.4.1, tty-browseri fy@0.0.0, constants-browserify@1.0.0, domain-browser@1.2.0, https-browserify@0.0 .1, string_decoder@0.10.31, process@0.11.10, os-browserify@0.2.1, querystring-es 3@0.2.1, stream-browserify@2.0.2, util@0.10.4, events@1.1.1, vm-browserify@0.0.4 , timers-browserify@2.0.10, console-browserify@1.1.0, url@0.11.0, readable-strea m@2.3.6, assert@1.4.1, buffer@4.9.1, stream-http@2.8.3, browserify-zlib@0.1.4, c rypto-browserify@3.3.0)
├── uglify-js@2.7.5 (async@0.2.10, uglify-to-browserify@1.0.2, source-map@0.5.7, yargs@3.10.0)
└── watchpack@0.2.9 (graceful-fs@4.1.15, async@0.9.2, chokidar@1.7.0)
执行webpack -v后,显示如下:
C:\Users\31301\AppData\Roaming\npm\node_modules\webpack\bin\webpack.js:90
let notify =
^^^
SyntaxError: Block-scoped declarations (let, const, function, class) not yet sup ported outside strict mode
at exports.runInThisContext (vm.js:53:16)
at Module._compile (module.js:373:25)
at Object.Module._extensions..js (module.js:416:10)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
at Function.Module.runMain (module.js:441:10)
at startup (node.js:139:18)
at node.js:968:3
请问老师该如何解决?
写回答
1回答
-
Rosen
2019-02-12
安装的时候要指定下webpack版本,再就是把node升级到6.12.3吧
00
相似问题