NativeScript / NativeScript/nativescript-cli

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

Open
#5,371 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
JavaScript
Stars
1.1k
Forks
204
Avg merge
1d 9h
Merged PRs (30d)
8

Description

  • 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.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the Windows CLI installation failure and trace the path passed from postinstall.js into lib/common/services/cancellation.js and lib/common/file-system.js. Compare the generated path with the mkdirp path-arg.js validation, then verify that npm installation completes without an illegal path on the reported Node and Windows setup.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, nodejs
Domain
cli
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.