这个必要性,就很少说了,进入开源的世界,没有 git 步履维艰javascript
进入 官网html
下载后是一个安装包,一路 下一步
安装直到完成前端
打开网站 https://nodejs.org/en/ 选择下载 LTS 版本。vue
下载后是一个安装包,一路 下一步
安装直到完成java
测试安装结果node
node -v npm -v
为了加速 npm 的安装速度,咱们用淘宝提供的源,这个问题在其它包管理软件也会遇到react
npm config set registry https://registry.npm.taobao.org
验证配置webpack
npm config get registry
这样就完成了加速git
其实如今的 cnpm 版本已经很稳定了,早先会有下载包错误问题,毕竟产品成熟须要时间,cnpm官网github
全局安装
npm install -g cnpm 若是你没有配置淘宝镜像能够参数传入加速 npm install -g cnpm --registry=https://registry.npm.taobao.org
yarn 是个很优秀的包管理程序, react 官方示例都是推荐 yarn 安装,特色就是快,相信不久 npm 也会遇上的,好比已经下载过的包本地作缓存,下次就秒安装了
homebrew 方式
brew install yarn
若是没有安装 homebrew
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
直接下载安装包 Yarn Setup
一路 下一步
安装直到完成
cnpm install -g nrm
> nrm ls npm ---- https://registry.npmjs.org/ cnpm --- http://r.cnpmjs.org/ taobao - https://registry.npm.taobao.org/ nj ----- https://registry.nodejitsu.com/ rednpm - http://registry.mirror.cqupt.edu.cn/ npmMirror https://skimdb.npmjs.com/registry/ edunpm - http://registry.enpmjs.org/
> nrm use npm verb config Skipping project config: /Users/hans/.npmrc. (matches userconfig) Registry has been set to: https://registry.npmjs.org/
我的喜欢 npm 用官方源,cnpm 用来安装淘宝镜像,这样遇到包问题,能够手动调整,比较灵活。
cnpm install -g n
> n node/8.8.1 node/8.9.4 node/8.10.0 node/8.11.1 node/9.4.0 node/9.9.0
> n 8.11.2
> n latest
> n stable
> n lts
> n rm 8.8.1
推荐理由 微软出品、免费、开源、速度快、轻量级、程序稳定、不卡、不卡、大文件秒开、语法高亮、升级频繁、配置方便
下载后是一个安装包,一路 下一步
安装直到完成
.editorconfig
root = true [*] charset = utf-8 indent_style = space indent_size = 2 end_of_line = lf insert_final_newline = true trim_trailing_whitespace = true tab_width = 1
没有请建立文件
cnpm install -g eslint
脚手架
建立项目,默认生成有 .eslintrc.js
配置文件侧栏 > 扩展 > 搜索 eslint
vscode
, 打开菜单 文件 > 首选项 > 设置
"eslint.alwaysShowStatus": true, "eslint.autoFixOnSave": "off", "eslint.validate": [ "javascript", { "language": "html", "autoFix": true }, { "language": "vue", "autoFix": true }, "javascriptreact", "html", "vue" ], "eslint.options": { "plugins": ["html"] },
代码格式化插件
侧栏 > 扩展 > 搜索 prettier
vscode
, 打开菜单 文件 > 首选项 > 设置
"prettier.singleQuote": true, "prettier.semi": false, "prettier.bracketSpacing": false, "prettier.useTabs": false, "prettier.tabWidth": 2,
格式化文件
代码片断工具
侧栏 > 扩展 > 搜索 reactjs code snippets
MyApp.js
html 标签自动补完插件
侧栏 > 扩展 > 搜索 Auto Close Tag
html 标签更名自动同步插件
侧栏 > 扩展 > 搜索 Auto Rename Tag
vscode chrome 调试工具
侧栏 > 扩展 > 搜索 Debugger for Chrome
launch.json
{ // 使用 IntelliSense 了解相关属性。 // 悬停以查看现有属性的描述。 // 欲了解更多信息,请访问: https://go.microsoft.com/fwlink/?linkid=830387 "version": "0.2.0", "configurations": [ { "name": "Chrome", "type": "chrome", "request": "launch", "url": "http://localhost:3000", "webRoot": "${workspaceRoot}/src", "userDataDir": "${workspaceRoot}/.vscode/chrome", "sourceMapPathOverrides": { "webpack:///src/*": "${webRoot}/*" } } ] }
http://localhost:3000
服务须要已开启安装完插件都须要重启
vscode
才能生效