安裝Electron時報錯command sh -c node install.js,如何處理


最近在安裝Electron時報以下錯誤:

505 error code 1
506 error path /Users/**/04sendSms/node_modules/electron
507 error command failed
508 error command sh -c node install.js
509 error RequestError: read ETIMEDOUT
509 error     at ClientRequest.<anonymous> (/Users/**/04sendSms/node_modules/got/source/request-as-event-emitter.js:178:14)
509 error     at Object.onceWrapper (node:events:514:26)
509 error     at ClientRequest.emit (node:events:406:35)
509 error     at ClientRequest.origin.emit (/Users/**/04sendSms/node_modules/@szmarczak/http-timer/source/index.js:37:11)
509 error     at TLSSocket.socketErrorListener (node:_http_client:447:9)
509 error     at TLSSocket.emit (node:events:394:28)
509 error     at emitErrorNT (node:internal/streams/destroy:157:8)
509 error     at emitErrorCloseNT (node:internal/streams/destroy:122:3)
509 error     at processTicksAndRejections (node:internal/process/task_queues:83:21)
510 verbose exit 1

查找資料解決方法如下:

在安裝的時候添加一個參數--ignore-scripts

  --ignore-scripts表示npm將不會運行在package.json中指定的scripts腳本

npm install --save-dev electron --ignore-scripts

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM