前几天不小心卸载了 angular@cli,然后重装的时候发现,一直报错。如下:

××××××××@××××ln622653:/$ npm install -g @angular/cli
npm ERR! code EPROTO
npm ERR! errno EPROTO
npm ERR! request to https://registry.npmjs.org/@angular%2fcli failed, reason: write EPROTO 139822307051328:error:1408F10B:SSL routines:ssl3_get_record:wrong version number:../deps/openssl/openssl/ssl/record/ssl3_record.c:252:
npm ERR!

npm ERR! A complete log of this run can be found in:
npm ERR! /home/jiangdaowen/.npm/_logs/2018-08-20T01_58_47_424Z-debug.log

也试过网上面说的要先安装npm install -g typescript typings,也是如下报错:

npm ERR! code EPROTO
npm ERR! errno EPROTO
npm ERR! request to https://registry.npmjs.org/typescript failed, reason: write EPROTO 139955972261696:error:1408F10B:SSL routines:ssl3_get_record:wrong version number:../deps/openssl/openssl/ssl/record/ssl3_record.c:252:
npm ERR!

npm ERR! A complete log of this run can be found in:
npm ERR! /home/jiangdaowen/.npm/_logs/2018-08-20T01_59_11_990Z-debug.log

node 和npm都是没有问题的,通过node -v和npm -v都能显示出版本,我这里的版本是node=> v10.8.0,npm=>

6.2.0.

因为我们公司的网络需要用代理才能下载浏览相关网页。后来发现是要设置一个代理和仓库地址,有两种方式,如下:

1》一种是通过命令来设置。npm config set proxy=http://我是账号:我是密码@143.116.28.61:64000/

    其中143.116.28.61是代理的地址,64000是代理的端口。

      设置完代理之后,在设置一个的仓库地址   npm config set registry=http://registry.npmjs.org

  设置完成之后,系统会自动写入到.npmrc 文件

2?》还可以写到隐藏文件里面来。在linux的unbutu系统里面可以在home路径下面,按住Ctrl+h显示隐藏文件,找到.npmrc 文件。直接添加代理和仓库地址

     现在在输入安装命令:npm install -g @angular/cli

  ng -v  就可以看到版本号啦。

我这里写的是其中的个别错误的解决方案,事实上npm和ng 很容易出问题。特别是install和安装卸载的时候,很多种原因会导致失败。

附上安装node和npm的简易方式,绝对不会出错的方式。很简单:

angularjs环境配置
1.下载nodejs安装包,解压到不需要sudo权限的地址。
2. 修改.bashrc文件()

  export NodeJS=/opt/local/node-v9.4.0-linux-x64 (你的nodejs的存放地址)
  export PATH=${JAVA_HOME}/bin:$NodeJS/bin:$PATH

3. source ~/.bashrc (修改全局变量之后使其立即生效)
 4. 配置代理 npm config set proxy=http://duncan_jiang:*****@143.116.28.61:64000/   (代理选用,看你自己的网络是不是需要代理,如果不需要代理就直接设置仓库地址就好了。)
   配置仓库地址:npm config set registry=http://registry.npmjs.org
4. npm install -g @angular/cli

5. ng -v查看版本

小提示:当你没有安装好cli时,而ng server --open 启动项目报错,可以使用 npm start启动

  

重装@angular/cli reason: write EPROTO 139955972261696:error:1408F10B:SSL routines:ssl3_get_record:wrong version number:../deps/openssl/openssl/ssl/record/ssl3_record.c:252:的更多相关文章

  1. npm install Error:EPROTO: protocol error, symlink '../mime/cli.js' -> '/vagrant/src/nodejs/node_modules/express/node_modules/send/node_modules/.bin/mime'

    我在ubuntu上使用npm安装依赖是出现下面错误: npm ERR! Linux 3.13.0-101-genericnpm ERR! argv "/usr/bin/nodejs" ...

  2. Protrator 官网和下载工具稍慢 , 但能使用. Angular CLI 内置 官方推荐 TS的 demo 不明显 , 而且依赖无法安装

    npm uninstall -g protractor  && cnpm install -g protractor && protractor --version 复 ...

  3. angular4.0 安装最新版本的nodejs、npm、@angular/cli的方法

    在使用ng项目的ui框架时,比如ng-zorro.angular Material,需要安装最新版本的@angular/cli: 配置ng-zorro框架 ng-zorro官网:https://ng. ...

  4. Angular CLI 升级 6.0 之后遇到的问题

    Angular CLI 1.7.4 在使用 ng build --prod 会构建失败,而 ng build 是正常的.比较好的解决办法是使用 ng build --prod --extract-li ...

  5. npm install -g @angular/cli@latest 失败

    一开始的ERROR信息是 error "@angular/compiler-cli" package was not properly installed 尝试方案二时又出现了以下 ...

  6. [转]使用 Angular CLI 和 ng-packagr 构建一个标准的 Angular 组件库

    使用 Angular CLI 构建 Angular 应用程序是最方便的方式之一. 项目目标 现在,我们一起创建一个简单的组件库. 首先,我们需要创建一个 header 组件.这没什么特别的,当然接下来 ...

  7. @angular/cli项目构建--modal

    环境准备: cnpm install ngx-bootstrap-modal --save-dev impoerts: [BootstrapModalModule.forRoot({container ...

  8. Angular CLI: 1.6.7 入门

    当你使用npm或者yarn也安装不了angular-cli时,请使用淘宝镜像. Step1 npm i -g cnpm --registry=https://registry.npm.taobao.o ...

  9. Angular CLI behind the scenes, part one

    原文:https://commandlinefanatic.com/cgi-bin/showarticle.cgi?article=art074 --------------------------- ...

随机推荐

  1. hwy题目选讲

    \[ f(n) = n/5 + f(n/5)\\ g(n) = (n\mod10)! * g(n/5)\mod 5\\ ans = f(n)*inv(2^g(n))\\ \]

  2. python统计字词练习

    方法一: import operator from nltk.corpus import stopwords stop_words = stopwords.words('English')#目的是去除 ...

  3. srand rand

    #include <stdlib.h> srand( (time(0)); rand()%100;

  4. Chrome_断点调试(使用vue-resource进行数据交互)

    一.使用vue-resource插件进行数据交互式,返回的并不是直接的json数据,其实还封装了一层. 如下代码:直接使用 res.result.list 取不到数据. methods:{ cartv ...

  5. Solve fatal error: helper_math.h: No such file or directory

    When the 'fatal error: helper_math.h: No such file or directory' occurs, it means the 'helper_math.h ...

  6. /var/spool/clientmqueue目录~清理

    今天nagios报警,一台服务器的disk满了,使用du -sh * 或 du -sh /* 查看目录的大小,查找占用空间大的目录/var/spool/clientmqueue.... 然后我就想/v ...

  7. eclipse部分常用快捷键

    -------------eclipse常用快捷键------------- 1.alt+?或alt+/:自动补全代码或者提示代码 2.ctrl+o:快速outline视图 3.ctrl+shift+ ...

  8. PHP算法学习(8) 环形链表 解决约瑟夫问题

    2019年2月25日17:29:17 Josephus有过的故事:39 个犹太人与Josephus及他的朋友躲到一个洞中,39个犹太人决定宁愿死也不要被敌人抓.于是决定了自杀方式,41个人排成一个圆圈 ...

  9. 屏蔽登录QQ后总是弹出的QQ网吧页面

    不知道从什么时候开始的,每次登录QQ的时候,有个叫qq网吧的页面都会弹出来,腾讯你是撒吗?这个公司真是死性不改.按照它的提示,已经设置了好几次这是我家,这特么不是网吧,然并卵.你说它技术不行吧,它堪称 ...

  10. mysql ON DUPLICATE KEY UPDATE 与 REPLACE INTO 的区别

    #mysql ON DUPLICATE KEY UPDATE 如果在INSERT语句末尾指定了ON DUPLICATE KEY UPDATE,并且插入行后会导致在一个UNIQUE索引或PRIMARY ...