vue init webpack#1.0 my-project not work
when i use this comand on my mac, i inccured an error and the error info is as following:
var hasDist = JSON.parse(body).some(function (branch) {
^
TypeError: JSON.parse(...).some is not a function
at Request._callback (/usr/local/lib/node_modules/vue-cli/bin/vue-init:130:38)
at Request.self.callback (/usr/local/lib/node_modules/vue-cli/node_modules/request/request.js:200:22)
at emitTwo (events.js:100:13)
at Request.emit (events.js:185:7)
at Request.<anonymous> (/usr/local/lib/node_modules/vue-cli/node_modules/request/request.js:1067:10)
at emitOne (events.js:95:20)
at Request.emit (events.js:182:7)
at IncomingMessage.<anonymous> (/usr/local/lib/node_modules/vue-cli/node_modules/request/request.js:988:12)
at emitNone (events.js:85:20)
at IncomingMessage.emit (events.js:179:7)
at endReadableNT (_stream_readable.js:906:12)
at nextTickCallbackWith2Args (node.js:475:9)
at process._tickCallback (node.js:389:17)
@alicePan which node do you use? I think you need to have at least node 4+
my node version is 5.10.1,i also inccured the erro above
.some() is ES5, it will work in all node versions. It simply seems JSON.parse(body) does not return an array. Since the github API should normally respond with an array, I would assume that the response it not what vue-cli expects.
Are you inside a corporate network? Maybe your IT blocks this request and returns an internal "blocked" HTML page in its place, or something? that would screw up the response format.
@LinusBorg my network is ok,and i already installed the webpack template version 1.0 before vue2.0 published,but now i want to init a new project with vue 1.x ,it does not work.
which version of vue-cli are you using? The latest version should not even have this check if I'm not mistaken.
@LinusBorg i found the solution ,the latest: 2.4.0 i installed: 2.1.0,i update the vue-cli and the error solved,thanks a lot!
➜ ~ vue init browserify test
This will install Vue 2.x version of template.
For Vue 1.x use: vue init browserify#1.0 test
? Project name (test)
➜ ~ ➜ ~ vue init browserify#1.0 test zsh: no matches found: browserify#1.0
@josephwlh vue init browserify#1.0 test works for me. What version on vue-cli do you use?