Npm 安装提示 EUNSUPPORTEDPROTOCOL 错误
完整的错误信息为:
14 verbose stack Error: Unsupported URL Type "npm:": npm:@elastic/elasticsearch@7.13.0
14 verbose stack at unsupportedURLType (C:\Users\huyuc\AppData\Roaming\nvm\v8.9.4\node_modules\npm\node_modules\npm-package-arg\npa.js:197:15)
14 verbose stack at fromURL (C:\Users\huyuc\AppData\Roaming\nvm\v8.9.4\node_modules\npm\node_modules\npm-package-arg\npa.js:250:13)
14 verbose stack at Function.resolve (C:\Users\huyuc\AppData\Roaming\nvm\v8.9.4\node_modules\npm\node_modules\npm-package-arg\npa.js:71:12)
14 verbose stack at module.exports (C:\Users\huyuc\AppData\Roaming\nvm\v8.9.4\node_modules\npm\lib\install\realize-shrinkwrap-specifier.js:21:14)
14 verbose stack at BB.each (C:\Users\huyuc\AppData\Roaming\nvm\v8.9.4\node_modules\npm\lib\install\inflate-shrinkwrap.js:51:23)
14 verbose stack at tryCatcher (C:\Users\huyuc\AppData\Roaming\nvm\v8.9.4\node_modules\npm\node_modules\bluebird\js\release\util.js:16:23)
14 verbose stack at Object.gotValue (C:\Users\huyuc\AppData\Roaming\nvm\v8.9.4\node_modules\npm\node_modules\bluebird\js\release\reduce.js:155:18)
14 verbose stack at Object.gotAccum (C:\Users\huyuc\AppData\Roaming\nvm\v8.9.4\node_modules\npm\node_modules\bluebird\js\release\reduce.js:144:25)
14 verbose stack at Object.tryCatcher (C:\Users\huyuc\AppData\Roaming\nvm\v8.9.4\node_modules\npm\node_modules\bluebird\js\release\util.js:16:23)
14 verbose stack at Promise._settlePromiseFromHandler (C:\Users\huyuc\AppData\Roaming\nvm\v8.9.4\node_modules\npm\node_modules\bluebird\js\release\promise.js:512:31)
14 verbose stack at Promise._settlePromise (C:\Users\huyuc\AppData\Roaming\nvm\v8.9.4\node_modules\npm\node_modules\bluebird\js\release\promise.js:569:18)
14 verbose stack at Promise._settlePromise0 (C:\Users\huyuc\AppData\Roaming\nvm\v8.9.4\node_modules\npm\node_modules\bluebird\js\release\promise.js:614:10)
14 verbose stack at Promise._settlePromises (C:\Users\huyuc\AppData\Roaming\nvm\v8.9.4\node_modules\npm\node_modules\bluebird\js\release\promise.js:693:18)
14 verbose stack at Async._drainQueue (C:\Users\huyuc\AppData\Roaming\nvm\v8.9.4\node_modules\npm\node_modules\bluebird\js\release\async.js:133:16)
14 verbose stack at Async._drainQueues (C:\Users\huyuc\AppData\Roaming\nvm\v8.9.4\node_modules\npm\node_modules\bluebird\js\release\async.js:143:10)
14 verbose stack at Immediate.Async.drainQueues (C:\Users\huyuc\AppData\Roaming\nvm\v8.9.4\node_modules\npm\node_modules\bluebird\js\release\async.js:17:14)
15 verbose cwd D:\WorkDir\FacilityConneX\Source-Code\Services\API
16 verbose Windows_NT 10.0.19043
17 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "--frozen-lockfile"
18 verbose node v8.9.4
19 verbose npm v5.6.0
20 error code EUNSUPPORTEDPROTOCOL
21 error Unsupported URL Type "npm:": npm:@elastic/elasticsearch@7.13.0
22 verbose exit [ 1, true ]
从上面的错误信息我们来抓重点看就是第一行 verbose stack Error: Unsupported URL Type "npm:": npm:@elastic/elasticsearch@7.13.0
Unsupported URL Type 这个错误。
错误原因和解决
出现这个错误的原因是你的 node 版本可能过低了。
你需要切换使用更高一点的 node 版本。
如果你对切换 node 的版本和 NPM 之间的关系有什么不清楚的话,可以参考下面的内容:NPM 和 NVM
当你切换 node 版本完成后,再次尝试安装就应该能够解决你的这个问题了。
当我们切换版本完成后再次进行安装,就能够成功了。