@@ -29,7 +29,7 @@ const ping = url => new Promise((resolve, reject) => {
2929
3030let checked
3131let result
32- const shouldUseTaobao = async ( command ) => {
32+ const shouldUseTaobao = async ( ) => {
3333 // ensure this only gets called once.
3434 if ( checked ) return result
3535 checked = true
@@ -46,8 +46,8 @@ const shouldUseTaobao = async (command) => {
4646 return val
4747 }
4848
49- const userCurrent = ( await execa ( command , [ 'config' , 'get' , 'registry' ] ) ) . stdout
50- const defaultRegistry = registries [ command ]
49+ const userCurrent = ( await execa ( `npm` , [ 'config' , 'get' , 'registry' ] ) ) . stdout
50+ const defaultRegistry = registries . npm
5151 if ( userCurrent !== defaultRegistry ) {
5252 // user has configured custom regsitry, respect that
5353 return save ( false )
@@ -67,7 +67,7 @@ const shouldUseTaobao = async (command) => {
6767 name : 'useTaobaoRegistry' ,
6868 type : 'confirm' ,
6969 message : chalk . yellow (
70- ` Your connection to the the default ${ command } registry seems to be slow.\n` +
70+ ` Your connection to the the default npm registry seems to be slow.\n` +
7171 ` Use ${ chalk . cyan ( registries . taobao ) } for faster installation?`
7272 )
7373 } ] )
@@ -102,20 +102,27 @@ module.exports = async function installDeps (targetDir, command, cliRegistry) {
102102 } else if ( command === 'yarn' ) {
103103 // do nothing
104104 } else {
105- throw new Error ( `unknown package manager: ${ command } ` )
105+ throw new Error ( `Unknown package manager: ${ command } ` )
106+ }
107+
108+ if ( command === 'yarn' && cliRegistry ) {
109+ throw new Error (
110+ `Inline registry is not supported when using yarn. ` +
111+ `Please run \`yarn config set registry ${ cliRegistry } \` before running @vue/cli.`
112+ )
106113 }
107114
108115 const altRegistry = (
109116 cliRegistry || (
110- ( await shouldUseTaobao ( command ) )
117+ ( command === 'npm' && await shouldUseTaobao ( ) )
111118 ? registries . taobao
112119 : null
113120 )
114121 )
115122
116123 if ( altRegistry ) {
117124 args . push ( `--registry=${ altRegistry } ` )
118- if ( command === 'npm' && altRegistry === registries . taobao ) {
125+ if ( altRegistry === registries . taobao ) {
119126 args . push ( `--disturl=${ taobaoDistURL } ` )
120127 }
121128 }
0 commit comments