簡體   English   中英

運行 npm install 時無法驗證第一個證書

[英]unable to verify the first certificate when running npm install

我正在查看 Angular2 教程: https : //github.com/angular/quickstart/blob/master/README.md

但是,當我按照指南運行 npm install 時,我最初遇到了與UNABLE_TO_VERIFY_LEAF_SIGNATURE相關的錯誤。 谷歌搜索似乎與 SSL 證書有關,因此我嘗試使用以下命令解決此問題:

npm config set strict-ssl false

然后我重試了npm install

這有點進一步,但隨后出現了與“無法驗證第一個證書”相關的新錯誤:

 typings ERR! message Unable to connect to "https://api.typings.org/entries/dt/core-js/tags/0.0.0%2B20160725163759" typings ERR! caused by unable to verify the first certificate typings ERR! cwd c:\\Code\\Angular2\\Quickstart typings ERR! system Windows_NT 6.1.7601 typings ERR! command "C:\\\\Program Files\\\\nodejs\\\\node.exe" "c:\\\\Code\\\\Angular2\\\\Quickstart\\\\node_modules\\\\typings\\\\dist\\\\bin.js" "install" typings ERR! node -v v6.7.0 typings ERR! typings -v 1.4.0 typings ERR! code EUNAVAILABLE typings ERR! If you need help, you may report this error at: typings ERR! <https://github.com/typings/typings/issues> npm WARN optional Skipping failed optional dependency /chokidar/fsevents: npm WARN notsup Not compatible with your operating system or architecture: fsevents@1.0.14 npm WARN angular-quickstart@1.0.0 No license field. npm ERR! Windows_NT 6.1.7601 npm ERR! argv "C:\\\\Program Files\\\\nodejs\\\\node.exe" "C:\\\\Program Files\\\\nodejs\\\\node_modules\\\\npm\\\\bin\\\\npm-cli.js" "install" npm ERR! node v6.7.0 npm ERR! npm v3.10.3 npm ERR! code ELIFECYCLE npm ERR! angular-quickstart@1.0.0 postinstall: `typings install` npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the angular-quickstart@1.0.0 postinstall script 'typings install'. npm ERR! Make sure you have the latest version of node.js and npm installed. npm ERR! If you do, this is most likely a problem with the angular-quickstart package, npm ERR! not with npm itself. npm ERR! Tell the author that this fails on your system: npm ERR! typings install npm ERR! You can get information on how to open an issue for this project with: npm ERR! npm bugs angular-quickstart npm ERR! Or if that isn't available, you can get their info via: npm ERR! npm owner ls angular-quickstart npm ERR! There is likely additional logging output above. npm ERR! Please include the following file with any support request: npm ERR! c:\\Code\\Angular2\\Quickstart\\npm-debug.log

我是 NodeJS 和 Angular2 開發的新手。 有任何想法嗎 ? 如果我遺漏了任何細節,請告訴我。

在我的情況下,將 .npmrc 中的 ca 文件添加到公司代理證書是解決方案:

npm config set cafile "path to proxy cert file"

或在 .npmrc 中使用編輯器插入:

cafile=<path to proxy cert file>

.npmrc 文件位於主目錄中。

您可以嘗試將注冊表更改為config中的http版本

npm config set registry http://registry.npmjs.org/ --global

我可以通過使用這里的說明解決問題: https//github.com/typings/typings/issues/564

問題最終與我的機器背后的某些公司代理相關,這似乎與npm無法對代理進行身份驗證https有關。 由於我沒有關於正在使用的代理的任何進一步信息,因此無法根據上面的@leetibbett建議進行配置。 所以我在根目錄下創建了.typingsrc文件以使用http版本:

{
     "rejectUnauthorized": false,
     "registryURL": "http://api.typings.org/"
}

我卸載了節點Js 12並重新安裝了版本10.這解決了我的問題。 我不確定問題是否是版本,但您可以嘗試。 我希望這對你有所幫助。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM