【npm install】Npm ERR! Line breaks can’t be quoted on Windows

PS E:\project\out_work\pc-v1> npm install swiper
npm ERR! Line breaks can't be quoted on Windows

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Tensai\AppData\Local\npm-cache\_logs\2021-12-18T19_18_34_550Z-debug.log
PS E:\project\out_work\pc-v1> npm install joi
npm ERR! Line breaks can't be quoted on Windows

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Tensai\AppData\Local\npm-cache\_logs\2021-12-18T19_19_05_960Z-debug.log
PS E:\project\out_work\pc-v1>

处理步骤

原文

  1. go to the script mentioned in the error (‘C:\Program Files\nodejs\node_modules\npm\node_modules\puka\index.js’)
  2. Look for the line: throw new Error(“Line breaks can’t be quoted on Windows”) in the function quoteForCmd and comment it.
  3. type the following code: text.replace(/[\n\r]/,’ ') bellow the commented line;
  4. Save the file.
  5. Run the npm script again.

翻译

  1. 找到这个报错的文件 (C:\Program Files\nodejs\node_modules\npm\node_modules\puka\index.js)
  2. 找到这一行: throw new Error(“Line breaks can’t be quoted on Windows”) 注释掉他
  3. 然后在他的下面写上这一行: text.replace(/[\n\r]/,'')
  4. 保存
  5. 重新 npm install
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章