NativeScript / NativeScript/nativescript-cli

CLI Installation fails when excecuting 'postininstall.js / postuninstall.js'

未關閉
#5,371 2 則留言 0 個 reaction 已指派 0 人 在 GitHub 檢視

還沒有人認領這個 Issue。

主要語言
JavaScript
星號
1.1k
分支
204
平均合併
1 天 9 小時
30 天內合併 PR
8

描述

  • CLI: 7.0.6
  • Windows 10 x64
  • Node 12.18.3 / Tried Current and 10.
  • Npm v6.14.6 / Tried clearing cache and reinstalling everything including node.

I'm trying to install the cli but can't get a work around.

C:\Users\prego\AppData\Roaming\npm\ns -> C:\Users\prego\AppData\Roaming\npm\node_modules\nativescript\bin\tns
> nativescript@7.0.6 postinstall C:\Users\prego\AppData\Roaming\npm\node_modules\nativescript
> node postinstall.js
Error: Illegal characters in path.
    at pathArg (C:\Users\prego\AppData\Roaming\npm\node_modules\nativescript\node_modules\mkdirp\lib\path-arg.js:20:27)
    at Function.mkdirpSync [as sync] (C:\Users\prego\AppData\Roaming\npm\node_modules\nativescript\node_modules\mkdirp\index.js:18:10)
    at FileSystem.createDirectory (C:\Users\prego\AppData\Roaming\npm\node_modules\nativescript\lib\common\file-system.js:176:16)
    at new CancellationService (C:\Users\prego\AppData\Roaming\npm\node_modules\nativescript\lib\common\services\cancellation.js:24:22)
    at Yok.resolveConstructor (C:\Users\prego\AppData\Roaming\npm\node_modules\nativescript\lib\common\yok.js:313:20)
    at Yok.resolveByName (C:\Users\prego\AppData\Roaming\npm\node_modules\nativescript\lib\common\yok.js:343:33)
    at Yok.resolve (C:\Users\prego\AppData\Roaming\npm\node_modules\nativescript\lib\common\yok.js:278:25)
    at C:\Users\prego\AppData\Roaming\npm\node_modules\nativescript\lib\common\yok.js:308:29
    at Array.map (<anonymous>)
    at Yok.resolveConstructor (C:\Users\prego\AppData\Roaming\npm\node_modules\nativescript\lib\common\yok.js:303:48)

I tested it with debugger and seems to fail parsing something like 'C:\Users\prego\AppData\Local\Temp\C:\Users\prego\KillSwitches' which is the received path arg at /path-arg.js

And right after this evaluation

const badWinChars = /[*|"<>?:]/
    const {root} = parse(path)
    if (badWinChars.test(path.substr(root.length))

Logs this error in console.
(node:3216) [DEP0016] DeprecationWarning: 'root' is deprecated, use 'global'

I didn't find anything related to this, just one issue with a similar error but tried everything and it didn't work.

貢獻指南

開啟貢獻指南

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

研究方向

先重現 Windows CLI 安裝失敗,並追蹤從 postinstall.js 傳入 lib/common/services/cancellation.js 和 lib/common/file-system.js 的路徑。將產生的路徑與 mkdirp path-arg.js 驗證進行比較,然後確認在所回報的 Node 與 Windows 設定上,npm 安裝可以在沒有非法路徑的情況下完成。

由索引模型根據 Issue 內容生成。

評估

技術堆疊
javascript, nodejs
領域
cli
Issue 類型
缺陷
難度
4/5
預估耗時
3-5 天
活躍度
停滯
描述清晰度
需要釐清
新手友好度
30/100

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。