【ERROR】npm install错误

在尝试npm install时遇到问题,报错'Unexpected end of JSON input while parsing near...'.通过设置淘宝npm镜像和禁用SSL验证作为解决方法。首先,使用'npm config set registry https://registry.npm.taobao.org'切换到淘宝镜像,然后清除缓存'npm cache clear --force',再次运行'npm install'。如果问题依旧,可以尝试'npm config set strict-ssl false'。

我还没解决composer的REST api的问题(访问不了explorer)。
【已解决,见rest部分】
也许现在这个版本没有吧,所以我进行了下一步。

报错

cielo@cielo-ThinkPad-E550:~/cprogrames/test-bna$  yo hyperledger-composer:angular
Welcome to the Hyperledger Composer Angular project generator
? Do you want to connect to a running Business Network? Yes
? Project name: angular-test
? Description: Hyperledger Composer Angular project
? Author name: cielo
? Author email: cielo0@qq.com
? License: Apache-2.0
? Name of the Business Network card: admin@test-bna
? Do you want to generate a new REST API or connect to an existing REST API?  Connect to an existing REST API
? REST server address: http://localhost
? REST server port: 3000
? Should namespaces be used in the generated REST API? Namespaces are not used
Created application!
Completed generation process
   create app.js
   create Dockerfile
   create e2e/app.e2e-spec.ts
   create e2e/app.po.ts
   create e2e/tsconfig.e2e.json
   create e2e/tsconfig.json
   create karma.conf.js
   create manifest.yml   create package.json
   create protractor.conf.js
   create proxy.conf.js
   create README.md
   create src/app/app-routing.module.ts
   create src/app/app.component.css
   create src/app/app.component.html
   create src/app/app.component.spec.ts
   create src/app/app.component.ts
   create src/app/app.module.ts
   create src/app/asset/images/delete_noun_cc.svg
   create src/app/asset/images/edit_noun_cc.svg
   create src/app/asset/images/failed_noun_cc.svg
   create src/app/asset/images/success_noun_cc.svg
   create src/app/data.service.ts
   create src/app/home/home.component.css
   create src/app/home/home.component.html
   create src/app/home/home.component.ts
   create src/environments/environment.prod.ts
   create src/environments/environment.ts
   create src/favicon.ico
   create src/index.html
   create src/main.ts
   create src/polyfills.ts
   create src/styles.css
   create src/test.ts
   create src/tsconfig.app.json
   create src/tsconfig.json
   create src/tsconfig.spec.json
   create tsconfig.json
   create tslint.json
   create .angular-cli.json
   create .editorconfig
   create .gitignore
   create .dockerignore
   create .cfignore
   create .npmignore
   create src/app/SampleAsset/SampleAsset.component.ts
   create src/app/SampleAsset/SampleAsset.service.ts
   create src/app/SampleAsset/SampleAsset.component.spec.ts
   create src/app/SampleAsset/SampleAsset.component.html
   create src/app/SampleAsset/SampleAsset.component.css
   create src/app/SampleParticipant/SampleParticipant.component.ts
   create src/app/SampleParticipant/SampleParticipant.service.ts
   create src/app/SampleParticipant/SampleParticipant.component.spec.ts
   create src/app/SampleParticipant/SampleParticipant.component.html
   create src/app/SampleParticipant/SampleParticipant.component.css
   create src/app/SampleTransaction/SampleTransaction.component.ts
   create src/app/SampleTransaction/SampleTransaction.service.ts
   create src/app/SampleTransaction/SampleTransaction.component.spec.ts
   create src/app/SampleTransaction/SampleTransaction.component.html
   create src/app/SampleTransaction/SampleTransaction.component.css


I'm all done. Running npm install for you to install the required dependencies. If this fails, try running the command yourself.


npm WARN registry Unexpected warning for https://registry.npmjs.org/: Miscellaneous Warning UNABLE_TO_VERIFY_LEAF_SIGNATURE: request to https://registry.npmjs.org/@types%2fnode failed, reason: unable to verify the first certificate
npm WARN registry Using stale package data from https://registry.npmjs.org/ due to a request error during revalidation.
npm ERR! code UNABLE_TO_VERIFY_LEAF_SIGNATURE
npm ERR! errno UNABLE_TO_VERIFY_LEAF_SIGNATURE
npm ERR! request to https://registry.npmjs.org/@angular%2fcommon failed, reason: unable to verify the first certificate

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/cielo/.npm/_logs/2019-04-11T01_30_28_730Z-debug.log
Application generated

npm install有问题。

cielo@cielo-ThinkPad-E550:~/cprogrames/test-bna/angular-test$ npm config set registry https://registry.npm.taobao.org
cielo@cielo-ThinkPad-E550:~/cprogrames/test-bna/angular-test$ npm cache clear --force
npm WARN using --force I sure hope you know what you are doing.
[..................] | : WARN using --force I sure hope you know what you are doing.
cielo@cielo-ThinkPad-E550:~/cprogrames/test-bna/angular-test$ npm install
npm ERR! code UNABLE_TO_VERIFY_LEAF_SIGNATURE
npm ERR! errno UNABLE_TO_VERIFY_LEAF_SIGNATURE
npm ERR! request to https://registry.npm.taobao.org/@angular%2fcommon failed, reason: unable to verify the first certificate

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/cielo/.npm/_logs/2019-04-11T04_44_38_527Z-debug.log

解决方法

(1)npm install 可能会报错

npm ERR! Unexpected end of JSON input while parsing near ‘…m":">=3"},"_hasShrink’

设置淘宝镜像
npm config set registry https://registry.npm.taobao.org
npm cache clear --force
再npm install


作者:meiguopai1
来源:优快云
原文:https://blog.youkuaiyun.com/meiguopai1/article/details/80664099
版权声明:本文为博主原创文章,转载请附上博文链接!

(2)npm config set strict-ssl false

https://stackoverflow.com/questions/31967581/node-js-error-unable-to-verify-leaf-signature-when-installing-express-framewo
似乎可以了,我给它一些时间运行吧。
在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值