Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/398.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/node.js/41.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/rest/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript NPM未安装软件包。主机名/IP地址不为';t匹配证书';替补队员姓名:_Javascript_Node.js_Macos_Express - Fatal编程技术网

Javascript NPM未安装软件包。主机名/IP地址不为';t匹配证书';替补队员姓名:

Javascript NPM未安装软件包。主机名/IP地址不为';t匹配证书';替补队员姓名:,javascript,node.js,macos,express,Javascript,Node.js,Macos,Express,有关解决方案,请参见下文 它昨天起作用了,但我不知道发生了什么事 NPM没有安装该软件包。主机名/IP地址与证书的别名不匹配: 主持人:registry.npmjs.org。不在证书的别名中:DNS:a.sni.fastly.net,DNS:a.sni.global-ssl.fastly.net 这就是我想做的: >> ROOT: } npm install up to date in 1.797s >> ROOT: } npm install express-

有关解决方案,请参见下文

它昨天起作用了,但我不知道发生了什么事

NPM没有安装该软件包。主机名/IP地址与证书的别名不匹配:

主持人:registry.npmjs.org。不在证书的别名中:DNS:a.sni.fastly.net,DNS:a.sni.global-ssl.fastly.net

这就是我想做的:

>> ROOT: }   npm install
up to date in 1.797s

>> ROOT: }   npm install express-messages
npm ERR! request to https://registry.npmjs.org/express-messages failed, reason: Hostname/IP doesn't match certificate's altnames: "Host: registry.npmjs.org. is not in the cert's altnames: DNS:a.sni.fastly.net, DNS:a.sni.global-ssl.fastly.net"

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/prashant/.npm/_logs/2018-09-01T11_54_09_205Z-debug.log
>> ROOT: }
我已经阅读了我能找到的所有文章/问题,并且重新安装了Node.js和npm,但是在那之后我也遇到了同样的问题

OS:macOS v10.12(塞拉)(16A323)

日志

0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/bin/node',
1 verbose cli   '/usr/local/bin/npm',
1 verbose cli   'install',
1 verbose cli   'express-messages' ]
2 info using npm@5.6.0
3 info using node@v8.11.4
4 verbose npm-session 54f0308df52fc8a7
5 silly install loadCurrentTree
6 silly install readLocalPackageData
7 silly fetchPackageMetaData error for express-messages@latest request to https://registry.npmjs.org/express-messages failed, reason: Hostname/IP doesn't match certificate's altnames: "Host: registry.npmjs.org. is not in the cert's altnames: DNS:a.sni.fastly.net, DNS:a.sni.global-ssl.fastly.net"
8 verbose type system
9 verbose stack FetchError: request to https://registry.npmjs.org/express-messages failed, reason: Hostname/IP doesn't match certificate's altnames: "Host: registry.npmjs.org. is not in the cert's altnames: DNS:a.sni.fastly.net, DNS:a.sni.global-ssl.fastly.net"
9 verbose stack     at ClientRequest.req.on.err (/usr/local/lib/node_modules/npm/node_modules/pacote/node_modules/make-fetch-happen/node_modules/node-fetch-npm/src/index.js:68:14)
9 verbose stack     at emitOne (events.js:116:13)
9 verbose stack     at ClientRequest.emit (events.js:211:7)
9 verbose stack     at TLSSocket.socketErrorListener (_http_client.js:387:9)
9 verbose stack     at emitOne (events.js:116:13)
9 verbose stack     at TLSSocket.emit (events.js:211:7)
9 verbose stack     at emitErrorNT (internal/streams/destroy.js:64:8)
9 verbose stack     at _combinedTickCallback (internal/process/next_tick.js:138:11)
9 verbose stack     at process._tickCallback (internal/process/next_tick.js:180:9)
10 verbose cwd /Users/prashant/Desktop/NodeJs-login-registration
11 verbose Darwin 16.0.0
12 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "express-messages"
13 verbose node v8.11.4
14 verbose npm  v5.6.0
15 error request to https://registry.npmjs.org/express-messages failed, reason: Hostname/IP doesn't match certificate's altnames: "Host: registry.npmjs.org. is not in the cert's altnames: DNS:a.sni.fastly.net, DNS:a.sni.global-ssl.fastly.net"
16 verbose exit [ 1, true ]
浏览器图像链接:

但是我已经尝试通过
npm set strict SSL false
更改SSL设置
npm config ls-l

它会阻塞此图像链接

然后出现此错误

更新 我的应用程序运行正常。只是我无法安装软件包

当我试图停止服务器时,出现了一种新的错误 (注意:如果与此有关,我已如上所述更改了SSL设置)

日志:当我停止服务器时

  • 将IP地址添加到您的
    /etc/hosts
    文件中

    转到此目录并执行
    sudo nano hosts


  • 并将其添加到主机文件:
    1.1.1.1 a.sni.fastly.net。

    尝试更改默认注册表:

    npm config set registry http://registry.npmjs.org
    
    对于所有坚持使用mup部署的人:

    docker:{
    //如果您的应用程序使用Meteor 1.4-1.5,请更改为“abernix/meteord:base”
    图片:“abernix/meteord:node-8.4.0-base”,
    建筑说明:[
    '运行npm配置设置严格ssl错误'
    ]
    
    },将以下行添加到
    /etc/hosts
    文件中:

    104.16.16.35 registry.npmjs.org
    

    根据事件报告,npmjs存在DNS问题:

    要解决您的问题,请执行以下操作:

  • dig www.npmjs.com@1.1.1

    Linux上的示例输出

    ; <<>> DiG 9.10.3-P4-Ubuntu <<>> www.npmjs.com @1.1.1.1
    ;; global options: +cmd
    ;; Got answer:
    ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 50308
    ;; flags: qr rd ra; QUERY: 1, ANSWER: 3, AUTHORITY: 0, ADDITIONAL: 1
    
    ;; OPT PSEUDOSECTION:
    ; EDNS: version: 0, flags:; udp: 1452
    ;; QUESTION SECTION:
    ;www.npmjs.com.                 IN      A
    
    ;; ANSWER SECTION:
    www.npmjs.com.          128     IN      CNAME   www.npmjs.com.cdn.cloudflare.net.
    www.npmjs.com.cdn.cloudflare.net. 151 IN A      104.16.109.30
    www.npmjs.com.cdn.cloudflare.net. 151 IN A      104.16.110.30
    
    ;; Query time: 2 msec
    ;; SERVER: 1.1.1.1#53(1.1.1.1)
    ;; WHEN: Sat Sep 01 14:05:56 UTC 2018
    ;; MSG SIZE  rcvd: 120
    
    ;挖掘9.10.3-P4-Ubuntu www.npmjs.com@1.1.1
    ;; 全局选项:+cmd
    ;; 得到答案:
    ;; ->>标题/etc/hosts

  • 不要忘了在周末结束时拆除这条线路


    可能重复的@HardikShah如何在mac上工作?我有完全相同的问题,但是我刚刚通过Thread安装了crypto,通过Brewth安装了openssl。这是一个全球性问题。DNS问题。这是我的工作“暂时”:你的意思是改变https到https我做了一些事情,它的工作,看到上面的帖子,我已经更新了解决方案检查出来我需要这个答案。1.1.1.1现在正在为我返回损坏的a.sni.fastly.net ip,而不是实际的注册表ip。我可以确认这是否有效。在我的开发人员机器上添加以下行/etc/hosts修复了此问题。104.16.16.35注册表.npmjs.org。。你是怎么得到这个IP地址的?它不适合我,我正在使用Windows10@burnt1ce这很可能是用户从其地理区域进入npmjs.org时获得的IP地址。我在美国东南部&当我挖掘npmjs.org时,我看到我解析的IP是
    104.16.109.30
    我已经很多年没有在Windows上执行任何联网工作了,但我可以想象你有一个
    dig
    ,或者类似于dig的命令行实用程序来帮助确定你应该使用的IP地址(直到周末^为我工作,不得不使用nano打开
    /etc/hosts
    echo
    给我
    权限被拒绝
    ,因为我是个业余
    ;;连接超时;无法访问任何服务器
    。。。
    npm config set registry http://registry.npmjs.org
    
    104.16.16.35 registry.npmjs.org
    
    ; <<>> DiG 9.10.3-P4-Ubuntu <<>> www.npmjs.com @1.1.1.1
    ;; global options: +cmd
    ;; Got answer:
    ;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 50308
    ;; flags: qr rd ra; QUERY: 1, ANSWER: 3, AUTHORITY: 0, ADDITIONAL: 1
    
    ;; OPT PSEUDOSECTION:
    ; EDNS: version: 0, flags:; udp: 1452
    ;; QUESTION SECTION:
    ;www.npmjs.com.                 IN      A
    
    ;; ANSWER SECTION:
    www.npmjs.com.          128     IN      CNAME   www.npmjs.com.cdn.cloudflare.net.
    www.npmjs.com.cdn.cloudflare.net. 151 IN A      104.16.109.30
    www.npmjs.com.cdn.cloudflare.net. 151 IN A      104.16.110.30
    
    ;; Query time: 2 msec
    ;; SERVER: 1.1.1.1#53(1.1.1.1)
    ;; WHEN: Sat Sep 01 14:05:56 UTC 2018
    ;; MSG SIZE  rcvd: 120