Windows10安裝Remix踩過的坑

Windows10安裝Remix踩過的坑

npm ERR! code 128

24060 verbose stack Error: Command failed: git clone --depth=1 -q -b browserifyCompatible git://github.com/frozeman/WebSocket-Node.git D:\nodejs\node_cache_cacache\tmp\git-clone-d374c3d0 --config core.longpaths=true
24060 verbose stack warning: templates not found in C:\Users\Xinzhe\AppData\Local\Temp\pacote-git-template-tmp\git-clone-12631386
24060 verbose stack fatal: read error: Invalid argument
24060 verbose stack
24060 verbose stack at ChildProcess.exithandler (child_process.js:295:12)
24060 verbose stack at ChildProcess.emit (events.js:210:5)
24060 verbose stack at maybeClose (internal/child_process.js:1021:16)
24060 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:283:5)
24061 verbose cwd D:\remix-ide-master\remix-ide
24062 verbose Windows_NT 10.0.18362
24063 verbose argv “D:\nodejs\node.exe” “D:\nodejs\node_modules\npm\bin\npm-cli.js” “install”
24064 verbose node v12.13.0
24065 verbose npm v6.12.0
24066 error code 128
24067 error Command failed: git clone --depth=1 -q -b browserifyCompatible git://github.com/frozeman/WebSocket-Node.git D:\nodejs\node_cache_cacache\tmp\git-clone-d374c3d0 --config core.longpaths=true
24067 error warning: templates not found in C:\Users\Xinzhe\AppData\Local\Temp\pacote-git-template-tmp\git-clone-12631386
24067 error fatal: read error: Invalid argument
24068 verbose exit [ 1, true ]
remix安裝的坑
執行步驟:

第一步執行:git config --global url.“https://”.insteadOf git://

第二步執行:npm install

其他相關的解決方案參考:https://github.com/npm/npm/issues/16980

TypeError: err.code.match is not a function

這個問題一般在npm 6.10.0版本之前出現,主要原因是由於nodejs下的D:\nodejs\node_modules\npm\node_modules\pacote\lib目錄裏邊的with-tarball-stream.js中對err的判斷不全面所致:

......
110		if (opts.cache && err.code && !err.code.match(/^E\d{3}$/)) {
......

原文意思是:錯誤狀態碼是一個數字,而不是一個字符串,而且數值表型沒有一個匹配函數(The issue is that err.code is a Number, not a String, and the Number prototype does not have a match function.),因此npm官方在6.10.0之後的版本中將這段代碼修改爲如下:

110		if (opts.cache && err.code && !String(err.code).match(/^E\d{3}$/)) {
......

該問題的詳細說明,參考https://github.com/zkat/pacote/pull/170

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章