首页 > 技术文章 > CentOS8安装vue和vue-cli

Harold-Hua 2020-04-22 17:49 原文

安装vue

 '''

安装vue遇到警告

npm WARN saveError ENOENT: no such file or directory, open '/home/harold/package.json'
npm WARN enoent ENOENT: no such file or directory, open '/home/harold/package.json'
npm WARN harold No description
npm WARN harold No repository field.
npm WARN harold No README data
npm WARN harold No license field.

'''

$ npm init -y
$ vi /home/harold/package.json

'''

{
  "name": "harold",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "keywords": [],
  "author": "",
  "license": "ISC"
}

'''

将description填上,然后在添加 private

'''

{
  "name": "harold",
  "version": "1.0.0",
  "description": "lgsp",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "private": true,
  "keywords": [],
  "author": "",
  "license": "ISC"
}

'''

$ npm install vue
$ npm list vue

 

安装vue-cli

$ npm config set registry https://registry.npm.taobao.org
$ npm config get registry
$ sudo npm install -g @vue/cli

 

推荐阅读