Command vue init requires a global addon

前端 未结 3 598
忘了有多久
忘了有多久 2021-02-13 03:34

When I tried to vue init webpack test-app, I got the following error:

Command vue init requires a global addon to be installed.
Please run npm in         


        
相关标签:
3条回答
  • 2021-02-13 04:15

    From the vue-cli website, Vue CLI 3 uses the same vue binary , so it overwrites Vue CLI 2 (vue-cli). So if you need the legacy vue inityou should install the global bridge

    npm install -g @vue/cli-init
    # vue init now works exactly the same as vue-cli@2.x
    
    0 讨论(0)
  • 2021-02-13 04:24

    Please install npm install -g @vue/cli-init. Hope this will solve your problem.

    0 讨论(0)
  • 2021-02-13 04:28

    Looking at vue-cli repository I see two different ways of scaffolding vue projects.

    The v3 (beta) version, installed as npm install -g @vue/cli, creates projects using the following command:

    vue create my-project
    

    While the version 2.9.x, available at master branch, is installed as npm install -g vue-cli and it allows projects scaffolding with the following:

    vue init <template-name> <project-name>
    

    for example:

    vue init webpack my-project
    

    So, in your scenario, for v3 version you should use: vue create test-app.

    Here you can find further information.

    0 讨论(0)
提交回复
热议问题