Skip to content

[BUG] npm/npx is not handling directories with spaces (on Windows) correctly #502

Closed
@kaiyoma

Description

@kaiyoma

When I try to install packages (specifically, this one: https://www.npmjs.com/package/ts-rws) with the latest version of npm (6.13.0) on Windows 10, I get an error and a stack trace:

error ...\node_modules\ts-rws: Command failed.
Exit code: 7
Command: npx npm-force-resolutions
Arguments:
Directory: ...\node_modules\ts-rws
Output:
Error: EPERM: operation not permitted, mkdir 'C:\Users\Kyle'
TypeError: Cannot read property 'get' of undefined
    at errorMessage (C:\Program Files\Node.js\node_modules\npm\lib\utils\error-message.js:38:39)
    at errorHandler (C:\Program Files\Node.js\node_modules\npm\lib\utils\error-handler.js:201:13)
    at C:\Program Files\Node.js\node_modules\npm\bin\npm-cli.js:78:20
    at cb (C:\Program Files\Node.js\node_modules\npm\lib\npm.js:225:22)
    at C:\Program Files\Node.js\node_modules\npm\lib\npm.js:263:24
    at C:\Program Files\Node.js\node_modules\npm\lib\config\core.js:81:7
    at Array.forEach (<anonymous>)
    at C:\Program Files\Node.js\node_modules\npm\lib\config\core.js:80:13
    at f (C:\Program Files\Node.js\node_modules\npm\node_modules\once\once.js:25:25)
    at afterExtras (C:\Program Files\Node.js\node_modules\npm\lib\config\core.js:171:20)
C:\Program Files\Node.js\node_modules\npm\lib\utils\error-handler.js:97
  var doExit = npm.config.loaded ? npm.config.get('_exit') : true
                          ^

TypeError: Cannot read property 'loaded' of undefined
    at exit (C:\Program Files\Node.js\node_modules\npm\lib\utils\error-handler.js:97:27)
    at process.errorHandler (C:\Program Files\Node.js\node_modules\npm\lib\utils\error-handler.js:216:3)

The problem is that npm/npx is not quoting some directory correctly, which results in this:

Error: EPERM: operation not permitted, mkdir 'C:\Users\Kyle' 

I've been seeing this issue for a long time now (npx commands don't work on Windows), and I've been able to ignore the problem in the past, but now I can't install packages anymore, which is a huge problem. Is there a fix for this?

Metadata

Metadata

Assignees

No one assigned

    Labels

    Bugthing that needs fixingWontfixthis will not be worked onplatform:windowsis Windows-specific

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions