Vue.js环境搭建

2020-06-11  本文已影响0人  hello12qwerz

【1】node安装


安装好node, npm或者cnpm

node版本切换:

cnpm install -g n --force
n stable #切换到最新的稳定版本

【2】webpack安装

 cnpm install webpack -g

【3】vue-cli

cnpm install  vue-cli -g

【4】新建vue 工程

vue init webpack demo 出现如下错误:

➜  demo vue init webpack demo
/usr/local/lib/node_modules/vue-cli/bin/vue-init:60
let template = program.args[0]
^^^

SyntaxError: Block-scoped declarations (let, const, function, class) not yet supported outside strict mode
    at exports.runInThisContext (vm.js:53:16)
    at Module._compile (module.js:404:25)
    at Object.Module._extensions..js (module.js:432:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:311:12)
    at Function.Module.runMain (module.js:457:10)
    at startup (node.js:136:18)
    at node.js:972:3

解决方法:Node版本过低导致:

n stable #切换node到最新的稳定版即可

重新执行即可。

上一篇 下一篇

猜你喜欢

热点阅读