qbright / vue2_vuex2_webpack2_ssr

use vue2 + vuex2 + webpack2 to build a server-side-render service
65 stars 15 forks source link

run dev 时vue报错,his._init is not a function #2

Open wuhao000 opened 7 years ago

wuhao000 commented 7 years ago

我是npm install之后,直接运行npm run dev,就报这个错误

function Vue$3 (options) { if ("development" !== 'production' && !(this instanceof Vue$3)) { warn('Vue is a constructor and should be called with thenewkeyword'); } this._init(options); } 我自己之前也试过搭建webpack2.1+vue2.1的环境,也是卡在这个错误上了

qbright commented 7 years ago

按照上面的报的错误 Vue is a constructor and should be called width the new keyword,就是说Vue是个构造器,需要通过 new 关键字来实例化

busyhe commented 7 years ago
/Users/busyhe/Downloads/vue2_vuex2_webpack2_ssr-master 2/server.js:26
let renderer;
^^^

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: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:974:3

npm ERR! Darwin 16.1.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "dev"
npm ERR! node v4.6.0
npm ERR! npm  v3.10.9
npm ERR! code ELIFECYCLE
npm ERR! vue2_vuex2_webpack2_ssr@ dev: `node server`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the vue2_vuex2_webpack2_ssr@ dev script 'node server'.
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 vue2_vuex2_webpack2_ssr package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node server
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs vue2_vuex2_webpack2_ssr
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls vue2_vuex2_webpack2_ssr
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /Users/busyhe/Downloads/vue2_vuex2_webpack2_ssr-master 2/npm-debug.log