AngularJS2 基础学习: 参考 mybase 3-26 文件

angular 环境的构建:( 由于 Angular 编写的代码不是 浏览器可以直接运行的,需要经过编译,所以需要构建一个环境)

1, npm ,nodejs 的安装:
  npm 安装:(需要联网)
    sudo apt install npm

    查看安装成功: npm -v
    npm 设置代理:
      $ npm config set proxy http://username:password@server:port
      $ npm config set https-proxy http://username:pawword@server:port
      参考博客: https://blog.csdn.net/qq_34645412/article/details/74784408
    npm 取消代理: npm config delete proxy ( sudo )

  nodejs : https://nodejs.org/en/download/ (nodejs 官网)
    Ubuntu:/CentOS:
      wget https://nodejs.org/dist/v6.9.5/node-v6.9.5-linux-x64.tar.xz -- 也可以自己在官网下载
      tar -xvf node-v6.9.5-linux-x64.tar.xz
      sudo mv node-v6.9.5-linux-x64 /usr/local/node
      sudo ln -s /usr/local/node/bin/node /usr/local/bin/node
      sudo ln -s /usr/local/node/lib/node_modules/npm/bin/npm-cli.js /usr/local/bin/npm

      新加: sudo ln -s /usr/local/node/lib/node_modules/@angular/cli/bin/ng  /usr/local/bin/ng

      查看安装成功: node -v
      卸载nodejs:
        sudo apt-get remove nodejs
      参考博客: http://cnodejs.org/topic/550a425d3135610a365b0292

  参考博客: https://www.cnblogs.com/EasonJim/p/8324834.html
2, angularJS 环境搭建:

  (1) 安装 angular/cli , angular/cli 是一个命令行界面工具,用于创建项目,添加组件,服务,测试,打包,发布等任务;
    注意: angular/cli 需要 nodeJs > node.6.9.x 版本 ,npm > 3.x.x 版本
     安装: npm install -g @angular/cli
     安装成功检测: ng version
  (2) 创建新的项目: ng new my-app
  (3) 启动服务器: ng server --open    ( ctrl + c 关闭服务器 )
  (4) 访问首页: http://localhost:4200/

3, 文件及目录结构:

  代码目录:

  

  根目录文件:

    

常见错误:

直接将 nodejs 解压目录下面的 npm 拷贝到 /usr/local/bin/ 目录下面是不行的,
          由于 9.9.0 nodejs 版本的 npm 是有一个软链接 ,拷贝的时候,软链接没有拷贝
 
参考文档: Angular JS 中文官网:  https://angular.cn/guide/quickstart
 

AngularJS2 环境搭建:的更多相关文章

  1. AngularJS2之本地环境搭建

    前言:本来准备初探AngularJS2,结果成了复习git和再探node git的两个常见问题:一.github上传时出现error: src refspec master does not matc ...

  2. .NET Core系列 : 1、.NET Core 环境搭建和命令行CLI入门

    2016年6月27日.NET Core & ASP.NET Core 1.0在Redhat峰会上正式发布,社区里涌现了很多文章,我也计划写个系列文章,原因是.NET Core的入门门槛相当高, ...

  3. Azure Service Fabric 开发环境搭建

    微服务体系结构是一种将服务器应用程序构建为一组小型服务的方法,每个服务都按自己的进程运行,并通过 HTTP 和 WebSocket 等协议相互通信.每个微服务都在特定的界定上下文(每服务)中实现特定的 ...

  4. rnandroid环境搭建

    react-native 环境搭建具体步骤这个大家已经玩烂了,这个主要是记录下来自己做win7系统遇到的坑 1.com.android.ddmlib.installexception 遇到这个问题,在 ...

  5. python开发环境搭建

    虽然网上有很多python开发环境搭建的文章,不过重复造轮子还是要的,记录一下过程,方便自己以后配置,也方便正在学习中的同事配置他们的环境. 1.准备好安装包 1)上python官网下载python运 ...

  6. springMVC初探--环境搭建和第一个HelloWorld简单项目

    注:此篇为学习springMVC时,做的笔记整理. MVC框架要做哪些事情? a,将url映射到java类,或者java类的方法上 b,封装用户提交的数据 c,处理请求->调用相关的业务处理—& ...

  7. 【定有惊喜】android程序员如何做自己的API接口?php与android的良好交互(附环境搭建),让前端数据动起来~

    一.写在前面 web开发有前端和后端之分,其实android还是有前端和后端之分.android开发就相当于手机app的前端,一般都是php+android或者jsp+android开发.androi ...

  8. Nexus(一)环境搭建

    昨天,成功搭建了自己的 Maven 环境(详见:Maven(一)环境搭建),今天就来研究和探讨下 Nexus 的搭建! 使用背景: 安装环境:Windows 10 -64位 JDK版本:1.7 Mav ...

  9. 「译」JUnit 5 系列:环境搭建

    原文地址:http://blog.codefx.org/libraries/junit-5-setup/ 原文日期:15, Feb, 2016 译文首发:Linesh 的博客:环境搭建 我的 Gith ...

随机推荐

  1. 当 return 遇到 try

    . . . . . 今天有同事和我探讨在群里看到的一道有趣的题目,在探讨的过程中让我搞清楚了一些曾经模糊的概念,特此记录下来. 题目给出如下代码,问运行后打印的结果是什么. public static ...

  2. WEB API Filter的使用以及执行顺序

    在WEB Api中,引入了面向切面编程(AOP)的思想,在某些特定的位置可以插入特定的Filter进行过程拦截处理.引入了这一机制可以更好地践行DRY(Don’t Repeat Yourself)思想 ...

  3. c# httpclient

    using Newtonsoft.Json; using System; using System.Collections.Generic; using System.IO; using System ...

  4. nuxt跨域

    根据nuxt官方文档提供的axios module 安装: npm install @nuxtjs/axios @nuxtjs/proxy --save nuxt.config.js modules: ...

  5. F - Currency Exchange

    来源poj1860 everal currency exchange points are working in our city. Let us suppose that each point sp ...

  6. Spring-boot(二)--thymeleaf

    @Controller @RequestMapping("/") public class MessageController { private final MessageRep ...

  7. Tesseract

    定义 Tesseract是一个将图像翻译成文字的OCR库(光学文字识别,Optical Character Recognition) 安装 sudo apt-get install tesseract ...

  8. elk-filebeat-(效果图示)(四)

    一.vim filebeat-6.3.2-linux-x86_64/filebeat.yml - type: log # Change to true to enable this input con ...

  9. requirejs配置问题

    <script src="lib/requirejs/require.js " data-main="js/main.js"> </scrip ...

  10. css学习_css伪元素的本质

    1.伪元素的本质(插入了一个元素(行内元素/标签/盒子) 案例1: 案例2: