Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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

CMD.EXE se inició con esta ruta como el directorio actual. No se permiten rutas UNC. Regresando de manera predeterminada al directorio Windows. #11422

Closed
1 task done
deCaldas opened this issue Apr 4, 2024 · 3 comments

Comments

@deCaldas
Copy link

deCaldas commented Apr 4, 2024

Windows Version

Microsoft Windows [Versión 10.0.22631.3296]

WSL Version

2.1.5.0

Are you using WSL 1 or WSL 2?

  • WSL 2
  • WSL 1

Kernel Version

5.15.146.1-2

Distro Version

Ubuntu 22.04

Other Software

Next.js version 14.1.4

Repro Steps

When I run npm run dev. And when I run npx create-next-app my-app

Expected Behavior

I can't create a Next.js app (npx create-next-app my-app) or run a development environment (npm run dev), but I can clone them (git clone [email protected]:deCaldas/home. git).

Actual Behavior

u@EjProI:~/home$ npm run dev

> [email protected] dev
> next dev -H 0.0.0.0

'\\wsl.localhost\Ubuntu\home\u\home'
CMD.EXE se inició con esta ruta como el directorio actual. No se permiten
rutas UNC. Regresando de manera predeterminada al directorio Windows.
   ▲ Next.js 14.1.4
   - Local:        http://localhost:3000
   - Network:      http://0.0.0.0:3000

Error: > Couldn't find any `pages` or `app` directory. Please create one under the project root
    at findPagesDir (\\wsl.localhost\Ubuntu\home\u\home\node_modules\next\dist\lib\find-pages-dir.js:42:15)
    at initialize (\\wsl.localhost\Ubuntu\home\u\home\node_modules\next\dist\server\lib\router-server.js:75:69)
    at async Server.<anonymous> (\\wsl.localhost\Ubuntu\home\u\home\node_modules\next\dist\server\lib\start-server.js:247:36)
u@EjProI:~$ npx create-next-app my-app
'\\wsl.localhost\Ubuntu\home\u'
CMD.EXE se inició con esta ruta como el directorio actual. No se permiten
rutas UNC. Regresando de manera predeterminada al directorio Windows.
√ Would you like to use TypeScript? ... No / Yes
√ Would you like to use ESLint? ... No / Yes
√ Would you like to use Tailwind CSS? ... No / Yes
√ Would you like to use `src/` directory? ... No / Yes
√ Would you like to use App Router? (recommended) ... No / Yes
√ Would you like to customize the default import alias (@/*)? ... No / Yes
√ What import alias would you like configured? ... @/*

Aborting installation.
Unexpected error. Please report it as a bug:
 Error: EPERM: operation not permitted, mkdir 'C:\Windows\my-app'
    at Object.mkdirSync (node:fs:1382:26)
    at createApp (C:\Users\PC\AppData\Local\npm-cache\_npx\efeac22998af9bf2\node_modules\create-next-app\dist\index.js:74:41579)
    at async run (C:\Users\PC\AppData\Local\npm-cache\_npx\efeac22998af9bf2\node_modules\create-next-app\dist\index.js:74:50510) {
  errno: -4048,
  code: 'EPERM',
  syscall: 'mkdir',
  path: 'C:\\Windows\\my-app'
}

Diagnostic Logs

It seems like a very common mistake.

Tasks

Preview Give feedback
  1. feature needs-author-feedback
Copy link

github-actions bot commented Apr 4, 2024

Logs are required for review from WSL team

If this a feature request, please reply with '/feature'. If this is a question, reply with '/question'.
Otherwise please attach logs by following the instructions below, your issue will not be reviewed unless they are added. These logs will help us understand what is going on in your machine.

How to collect WSL logs

Download and execute collect-wsl-logs.ps1 in an administrative powershell prompt:

Invoke-WebRequest -UseBasicParsing "https://raw.githubusercontent.com/microsoft/WSL/master/diagnostics/collect-wsl-logs.ps1" -OutFile collect-wsl-logs.ps1
Set-ExecutionPolicy Bypass -Scope Process -Force
.\collect-wsl-logs.ps1

The scipt will output the path of the log file once done.

Once completed please upload the output files to this Github issue.

Click here for more info on logging
If you choose to email these logs instead of attaching to the bug, please send them to [email protected] with the number of the github issue in the subject, and in the message a link to your comment in the github issue and reply with '/emailed-logs'.

@elsaco
Copy link

elsaco commented Apr 4, 2024

@deCaldas if you're running npm from WSL distro why is your app trying to write in the C:\Windows folder? That's a restricted directory used by the host OS only.

Here's sample output after cloning your home repo:

[elsaco@RIPPER home]$ npx create-next-app my-app
Need to install the following packages:
[email protected]
Ok to proceed? (y)
✔ Would you like to use TypeScript? … No / Yes
✔ Would you like to use ESLint? … No / Yes
✔ Would you like to use Tailwind CSS? … No / Yes
✔ Would you like to use `src/` directory? … No / Yes
✔ Would you like to use App Router? (recommended) … No / Yes
✔ Would you like to customize the default import alias (@/*)? … No / Yes
Creating a new Next.js app in /home/elsaco/home/my-app.

Using npm.

Initializing project with template: app-tw


Installing dependencies:
- react
- react-dom
- next

Installing devDependencies:
- typescript
- @types/node
- @types/react
- @types/react-dom
- autoprefixer
- postcss
- tailwindcss
- eslint
- eslint-config-next


added 367 packages, and audited 368 packages in 36s

137 packages are looking for funding
  run `npm fund` for details

found 0 vulnerabilities
Success! Created my-app at /home/elsaco/home/my-app

and

[elsaco@RIPPER my-app]$ npm run dev

> [email protected] dev
> next dev

   ▲ Next.js 14.1.4
   - Local:        http://localhost:3000

Attention: Next.js now collects completely anonymous telemetry regarding usage.
This information is used to shape Next.js' roadmap and prioritize features.
You can learn more, including how to opt-out if you'd not like to participate in this anonymous program, by visiting the following URL:
https://nextjs.org/telemetry

 ✓ Ready in 1188ms
(node:894) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
 ○ Compiling / ...
 ✓ Compiled / in 2.4s (511 modules)
 ✓ Compiled in 194ms (241 modules)
 ○ Compiling /favicon.ico ...
 ✓ Compiled /favicon.ico in 2.9s (518 modules)


The view from the Windows side on localhost:3000

node_test

@deCaldas
Copy link
Author

deCaldas commented Apr 5, 2024

@elsaco You're right!! That is how it should happen.

Let's say at some point I started working on Windows OS when I was learning and then I made a copy to WSL 2 distro Debian, then I started to make another copy to WSL 2 distro Ubuntu.
And yesterday I ran find . -type d -name "node_modules" -exec rm -rf {} + because I wanted to copy all my repositories to create a backup. And from then on it doesn't work anymore.
I tried uninstalling Ubuntu to install a new one. Apart from all the commands that I could search on the net.

The first thing I saw was that VSCode was not working. The that I see In the terminal was:

u@EjProI:~$ find . -type d -name "node_modules" -exec rm -rf {} +
u@EjProI:~$ cd home
u@EjProI:~/home$ code .
Loading "minimist" failed
Error: Cannot find module 'minimist'
Require stack:
- /home/u/.vscode-server/bin/5c3e652f63e798a5ac2f31ffd0d863669328dc4c/out/server-cli.js
    at Module._resolveFilename (node:internal/modules/cjs/loader:1077:15)
    at Module._load (node:internal/modules/cjs/loader:922:27)
    at Module.require (node:internal/modules/cjs/loader:1143:19)
    at require (node:internal/modules/cjs/helpers:119:18)
    at r (/home/u/.vscode-server/bin/5c3e652f63e798a5ac2f31ffd0d863669328dc4c/out/server-cli.js:3:98)
    at n.load (/home/u/.vscode-server/bin/5c3e652f63e798a5ac2f31ffd0d863669328dc4c/out/server-cli.js:2:1637)
    at p.load (/home/u/.vscode-server/bin/5c3e652f63e798a5ac2f31ffd0d863669328dc4c/out/server-cli.js:1:10823)
    at l (/home/u/.vscode-server/bin/5c3e652f63e798a5ac2f31ffd0d863669328dc4c/out/server-cli.js:3:9338)
    at Object.errorback (/home/u/.vscode-server/bin/5c3e652f63e798a5ac2f31ffd0d863669328dc4c/out/server-cli.js:3:9457)
    at p.triggerErrorback (/home/u/.vscode-server/bin/5c3e652f63e798a5ac2f31ffd0d863669328dc4c/out/server-cli.js:1:11117)
    at /home/u/.vscode-server/bin/5c3e652f63e798a5ac2f31ffd0d863669328dc4c/out/server-cli.js:1:10868
    at n.load (/home/u/.vscode-server/bin/5c3e652f63e798a5ac2f31ffd0d863669328dc4c/out/server-cli.js:2:1654)
    at p.load (/home/u/.vscode-server/bin/5c3e652f63e798a5ac2f31ffd0d863669328dc4c/out/server-cli.js:1:10823)
    at l (/home/u/.vscode-server/bin/5c3e652f63e798a5ac2f31ffd0d863669328dc4c/out/server-cli.js:3:9338)
    at f._loadModule (/home/u/.vscode-server/bin/5c3e652f63e798a5ac2f31ffd0d863669328dc4c/out/server-cli.js:3:9466)
    at f._resolve (/home/u/.vscode-server/bin/5c3e652f63e798a5ac2f31ffd0d863669328dc4c/out/server-cli.js:4:452)
    at f.defineModule (/home/u/.vscode-server/bin/5c3e652f63e798a5ac2f31ffd0d863669328dc4c/out/server-cli.js:3:5561)
    at _ (/home/u/.vscode-server/bin/5c3e652f63e798a5ac2f31ffd0d863669328dc4c/out/server-cli.js:4:1741)
    at m (/home/u/.vscode-server/bin/5c3e652f63e798a5ac2f31ffd0d863669328dc4c/out/server-cli.js:2:2448)
    at Object.<anonymous> (/home/u/.vscode-server/bin/5c3e652f63e798a5ac2f31ffd0d863669328dc4c/out/vs/server/node/server.cli.js:30:109669)
    at Object.<anonymous> (/home/u/.vscode-server/bin/5c3e652f63e798a5ac2f31ffd0d863669328dc4c/out/vs/server/node/server.cli.js:33:9233)
    at n._createAndEvalScript (/home/u/.vscode-server/bin/5c3e652f63e798a5ac2f31ffd0d863669328dc4c/out/server-cli.js:2:2492)
    at /home/u/.vscode-server/bin/5c3e652f63e798a5ac2f31ffd0d863669328dc4c/out/server-cli.js:2:2133
    at FSReqCallback.readFileAfterClose [as oncomplete] (node:internal/fs/read_file_context:68:3) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/home/u/.vscode-server/bin/5c3e652f63e798a5ac2f31ffd0d863669328dc4c/out/server-cli.js'
  ],
  phase: 'loading',
  moduleId: 'minimist',
  neededBy: [ 'vs/platform/environment/node/argv' ]
}
Here are the modules that depend on it:
[ 'vs/platform/environment/node/argv' ]
u@EjProI:~/home$

So I follow the path /home/u/.vscode-server/bin/5c3e652f63e798a5ac2f31ffd0d863669328dc4c to install "minimist" and that solved that specific problem. And you know the rest of the story.

Uninstall Ubuntu to install a new one...

@microsoft microsoft locked and limited conversation to collaborators Apr 5, 2024
@OneBlue OneBlue converted this issue into discussion #11428 Apr 5, 2024

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants