Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

node --require fails with Windows path separator #21918

Closed
targos opened this issue Jul 21, 2018 · 1 comment
Closed

node --require fails with Windows path separator #21918

targos opened this issue Jul 21, 2018 · 1 comment
Labels
cli Issues and PRs related to the Node.js command line interface. windows Issues and PRs related to the Windows platform.

Comments

@targos
Copy link
Member

targos commented Jul 21, 2018

  • Version: 10.7.0
  • Platform: Windows 10 x64
  • Subsystem: bootstrap

with test.js in cwd, try to run: node -r .\test.js

Error:

internal/modules/cjs/loader.js:583
    throw err;
    ^

Error: Cannot find module '.\test.js'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:581:15)
    at Function.Module._load (internal/modules/cjs/loader.js:507:25)
    at Module.require (internal/modules/cjs/loader.js:637:17)
    at Module._preloadModules (internal/modules/cjs/loader.js:805:12)
    at preloadModules (internal/bootstrap/node.js:575:7)
    at startup (internal/bootstrap/node.js:268:9)
    at bootstrapNodeJSCore (internal/bootstrap/node.js:596:3)
@targos targos added the windows Issues and PRs related to the Windows platform. label Jul 21, 2018
@vsemozhetbyt vsemozhetbyt added the cli Issues and PRs related to the Node.js command line interface. label Jul 21, 2018
@joaocgreis
Copy link
Member

Fix attempt: #22186

joaocgreis added a commit to JaneaSystems/node that referenced this issue Sep 1, 2018
Before this change, require('.\\test.js') failed while
require('./test.js') succeeded. This changes _resolveLookupPaths so
that both ways are accepted on Windows.

Fixes: nodejs#21918
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cli Issues and PRs related to the Node.js command line interface. windows Issues and PRs related to the Windows platform.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants