尝试安装npm atob时出错

问题描述 投票:0回答:3

我试图在我的项目中安装npm atob;但突然它现在显示错误:

   Linux 2.6.23.17-88.fc7
   npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install"  "atob"
   npm ERR! node v5.6.0
   npm ERR! npm  v3.8.8
   npm ERR! code CERT_NOT_YET_VALID
   npm ERR! certificate is not yet valid
   npm ERR! 
   npm ERR! If you need help, you may report this error at:
   npm ERR!     <https://github.com/npm/npm/issues>
   npm ERR! Please include the following file with any support request:
   npm ERR!     /home/www/project/npm-debug.log

但是当我搜索时,他们中的大多数都回答为“修复你的系统时间”

node.js
3个回答
0
投票

在获得有效认证之前,请尝试更正系统时间。否则尝试更改nodeJs的版本

sudo npm cache clean -f

sudo npm install -g n sudo n stable


0
投票

'btoa-atob'模块不会导出编程接口,它只提供命令行实用程序。如果您需要转换为Base64,您可以使用Buffer执行此操作:

console.log(new Buffer('Hello World!').toString('base64'));

反向(假设您正在解码的内容是utf8字符串):

console.log(new Buffer(b64Encoded, 'base64').toString());

0
投票

错误代码为CERT_NOT_YET_VALID -certificate尚未生效,它引用ssl证书。

这应该可以解决这个错误

$ npm config set strict-ssl false
$ npm config set unsafe-perm true
$ npm config set registry http://registry.npmjs.org/
© www.soinside.com 2019 - 2024. All rights reserved.