mac 下vue环境安装时遇到的问题记录
1. 使用brew install node 命令安装node 时遇到的问题:
MacBook-Pro:~ zh$ brew install node
==> Downloading https://homebrew.bintray.com/bottles-portable-ruby/portable-ruby-2.3.3_2.leopard_64.bottle.tar.gz
Already downloaded: /Users/zh/Library/Caches/Homebrew/portable-ruby-2.3.3_2.leopard_64.bottle.tar.gz
Error: Checksum mismatch.
Expected: f1db8863543d256e6a8e704bf618025030b3d22a7a6b19749d19f599b5554212
Actual: d3843f61522afd7a5340aa055847e549ab5f3b0a8ffafab46b556d427b903131
Archive: /Users/zh/Library/Caches/Homebrew/portable-ruby-2.3.3_2.leopard_64.bottle.tar.gz
To retry an incomplete download, remove the file above.
Error: Failed to upgrade vendor Ruby.
解决方法:
删除: /Users/zh/Library/Caches/Homebrew/portable-ruby-2.3.3_2.leopard_64.bottle.tar.gz 文件 后重新 运行 brew install node 命令
2. 安装vue 时报错 无pacakge.json 文件
zhaichuangdeMacBook-Pro:~ zhaichuang$ sudo npm install vue
Password:
npm WARN saveError ENOENT: no such file or directory, open ‘/Users/zhaichuang/package.json‘
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN enoent ENOENT: no such file or directory, open ‘/Users/zhaichuang/package.json‘
npm WARN zhaichuang No description
npm WARN zhaichuang No repository field.
npm WARN zhaichuang No README data
npm WARN zhaichuang No license field.
解决方法:
删除 ~(当前目录)下的 package-lock.json 文件 ,运行命令:sudo npm install vue -g
3. 安装vue-cli 时 遇到 npm ERR! Unexpected end of JSON input while parsing near ‘...prebuilt":"^2.1.4","p‘
zhaichuangdeMacBook-Pro:~ zhaichuang$ sudo npm install vue-cli -g
npm WARN deprecated coffee-script@1.12.7: CoffeeScript on NPM has moved to "coffeescript" (no hyphen)
npm ERR! Unexpected end of JSON input while parsing near ‘...prebuilt":"^2.1.4","p‘
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/zhaichuang/.npm/_logs/2018-06-01T14_24_54_473Z-debug.log
解决方法: 使用命令 npm cache clean --force 清除缓存 然后再运行命令:sudo npm i --global vue-cli 安装成功