四、Nuxt的介紹及簡單安裝(vue-cli4.x) -npx create-nuxt-app ‘xxx’ 創建項目報錯

在vue-cli的老版本中 是可以使用 vue init nuxt/starter 進行安裝的
但在新版本的vue-cli中不行了

使用官方推薦的npx來安裝:

(npm的5.2.x版本後默認安裝了npx)

項目安裝

npm install -g npx
npx create-nuxt-app  project name

輸入命令後:
npm ERR! code ENOLOCAL
npm ERR! Could not install from “Files\nodejs\node-cache_npx\16376” as it does not contain a package.json file.

npm ERR! A complete log of this run can be found in:
npm ERR! C:\Program Files\nodejs\node-cache_logs\2019-08-07T02_34_54_333Z-debug.log
Install for create-nuxt-app@latest failed with code 1

解決:

npm i -g create-nuxt-app
create-nuxt-app profect name

🎉 Successfully created project mt-app

To get started:

    cd mt-app
    npm run dev

To build & start for production:

    cd mt-app
    npm run build
    npm run start

樣就可以成功創建項目!

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章