这里准备记录下最近的前端学习过程。
安装 nodejs
首先看官方文档: nodejs官方安装指引
在 Ubuntu上安装如下:
@H_404_27@curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash - sudo apt-get install -y nodejs安装 npm
npm的官网 npm 网站
@H_404_27@sudo apt-get install npm然而npm 速度实在是太慢,所以有一个解决方案是 taobao做了一个同样的镜像源地址。
@H_404_27@http://npm.taobao.org/国内镜像源列表
@H_404_27@当前 registry.npm.taobao.org 是从 r.cnpmjs.org 进行全量同步的. 当前 npm.taobao.org 运行版本是: cnpmjs.org@ 本系统运行在 Node.js@ 上. 开源镜像: http://npm.taobao.org/mirrors Node.js 镜像: http://npm.taobao.org/mirrors/node alinode 镜像: http://npm.taobao.org/mirrors/alinode phantomjs 镜像: http://npm.taobao.org/mirrors/phantomjs ChromeDriver 镜像: http://npm.taobao.org/mirrors/chromedriver OperaDriver 镜像: http://npm.taobao.org/mirrors/operadriver Selenium 镜像: http://npm.taobao.org/mirrors/selenium Node.js 文档镜像: http://npm.taobao.org/mirrors/node/latest/docs/api/index.html NPM 镜像: https://npm.taobao.org/mirrors/npm/ electron 镜像: https://npm.taobao.org/mirrors/electron/ node-inspector 镜像: https://npm.taobao.org/mirrors/node-inspector/加速 npm
安装 cnpm方法:
@H_404_27@npm install -g cnpm --registry=https://registry.npm.taobao.org这个是安装 cnpm的方式,用这个代替 npm就好了。
或者修改 npm的源地址:
@H_404_27@npm config set registry https://registry.npm.taobao.org如果发现模块没有,可以同步:
@H_404_27@cnpm sync connect安装 react
react 官网地址位: react官网 给出了详细的安装方案。
@H_404_27@npm install -g create-react-app create-react-app my-app cd my-app npm start然后会出现:
@H_404_27@Compiled successfully! You can now view my-app in the browser. Local: http://localhost:3000/ On Your Network: http://172.17.142.115:3000/ Note that the development build is not optimized. To create a production build,use npm run build.访问:http://localhost:3000/
就可以看到了。