vue-cli icon indicating copy to clipboard operation
vue-cli copied to clipboard

vue init webpack#1.0 my-project not work

Open yonycat opened this issue 10 years ago • 8 comments

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)

yonycat avatar Oct 07 '16 02:10 yonycat

@alicePan which node do you use? I think you need to have at least node 4+

zigomir avatar Oct 07 '16 05:10 zigomir

my node version is 5.10.1,i also inccured the erro above

ice-bin-ux avatar Oct 07 '16 06:10 ice-bin-ux

.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 avatar Oct 07 '16 07:10 LinusBorg

@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.

ice-bin-ux avatar Oct 07 '16 07:10 ice-bin-ux

which version of vue-cli are you using? The latest version should not even have this check if I'm not mistaken.

LinusBorg avatar Oct 07 '16 07:10 LinusBorg

@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!

ice-bin-ux avatar Oct 07 '16 07:10 ice-bin-ux

➜ ~ 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 avatar Oct 17 '16 06:10 josephwlh

@josephwlh vue init browserify#1.0 test works for me. What version on vue-cli do you use?

zigomir avatar Oct 18 '16 15:10 zigomir