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

Won't run on Windows in folder 'drag&drop' #2569

Closed
ghost opened this issue Mar 17, 2021 · 17 comments · Fixed by #9379
Closed

Won't run on Windows in folder 'drag&drop' #2569

ghost opened this issue Mar 17, 2021 · 17 comments · Fixed by #9379
Labels

Comments

@ghost
Copy link

ghost commented Mar 17, 2021

Describe the bug

Vite won't run on Win10 in the folder with the name drag&drop (both dev/build)
Probably since Vite 1.x - #582

Logs

2021-03-17_221633

Translation:
"drop\node_modules.bin" - is not internal or external command, executable program, or batch file.

@patak-dev
Copy link
Member

@web2033 I tried to reproduce in my Windows 10 machine without success using a vanilla create-app. Does your repro do anything differently? Would you provide an example in GitHub in that case?

@ghost
Copy link
Author

ghost commented Mar 21, 2021

The code doesn't matter here. Vanilla apps and any other of my existing projects won't run if I rename a folder to include &.
Like drag-drop will work whereas drag&drop won't.

Tried on other non-Vite projects. Same error.
I think it interprets & as a part of npm scripts command.
Will close later if no one knows a reason...

@patak-dev
Copy link
Member

I don't understand why I can't reproduce in my Windows here. I'll let others with Windows machines test this one.

@patak-dev patak-dev added the help wanted Extra attention is needed label Mar 21, 2021
@github-actions
Copy link

Hello @web2033. We totally like your proposal/feedback, welcome to send us a Pull Request for it. Please provide changelog/TypeScript/documentation/test cases if needed and make sure CI passed, we will review it soon. We appreciate your effort in advance and looking forward to your contribution!

@ghost
Copy link
Author

ghost commented Mar 27, 2021

Tried other projects for comparison - create-react-app, adonis-ts-app.
They run fine in the drag&drop folder. Vite is not. 🤔

@GrygrFlzr
Copy link
Member

Able to replicate on my end with the vanilla template.

image

@patak-dev
Copy link
Member

For reference, in case it helps, it works both in dev and build on my Windows machine:

C:\Vue\test\drag&drop  (drag-drop@0.0.0) λ yarn build
yarn run v1.22.10
warning package.json: No license field
$ vite build
vite v2.1.3 building for production...
 4 modules transformed.
dist/assets/favicon.17e50649.svg   1.49kbdist/index.html                    0.45kbdist/assets/index.ccce2ca3.css     0.16kb / brotli: 0.10kb
dist/assets/index.b2293eba.js      0.77kb / brotli: 0.37kb
Done in 0.99s.

@GrygrFlzr
Copy link
Member

It seems that the issue only occurs on npm, and does not occur on yarn nor pnpm, though the latter outputs some strange warnings.

@ghost
Copy link
Author

ghost commented Mar 27, 2021

It seems that the issue only occurs on npm, and does not occur on yarn nor pnpm, though the latter outputs some strange warnings.

Yeah, was doing the same testing. Projects created with yarn work fine. (npm run dev, yarn dev both work)
Projects created with npm won't run on both npm/yarn.

@GrygrFlzr
Copy link
Member

Looking into this further, it seems that npm generates a different node_modules/.bin/vite file compared to yarn and pnpm.

@Timsonrobl
Copy link
Contributor

Timsonrobl commented Mar 27, 2021

This is an issue in npm, not an issue in vite.
It's reproducible with create-react-app without vite. Note that you have to uninstall yarn globally for this to work or it would default to building with yarn:

>mkdir "dir&withamp"
>cd "dir&withamp"
>npm init react-app my-app
>cd my-app
>npm start

Results in:

> my-app@0.1.0 start
> react-scripts start

"test\my-app\node_modules\.bin\" не является внутренней или внешней
командой, исполняемой программой или пакетным файлом.
node:internal/modules/cjs/loader:926
  throw err;
  ^

Error: Cannot find module 'D:\CODE\react-scripts\bin\react-scripts.js'
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:923:15)
    at Function.Module._load (node:internal/modules/cjs/loader:768:27)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:76:12)
    at node:internal/main/run_main_module:17:47 {
  code: 'MODULE_NOT_FOUND',
  requireStack: []
}
npm ERR! code 1
npm ERR! path D:\CODE\apm&test\my-app
npm ERR! command failed
npm ERR! command C:\WINDOWS\system32\cmd.exe /d /s /c react-scripts start

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Timson\AppData\Local\npm-cache\_logs\2021-03-27T19_31_11_997Z-debug.log

@ghost
Copy link
Author

ghost commented Mar 27, 2021

This is an issue in npm, not an issue in vite.

Wait. I have it working with another project using npm - https://preview.adonisjs.com/guides/quick-start

npm init adonis-ts-app drag

then rename the folder to drag&drop

npm run dev

Works!

2021-03-27_221011

@Timsonrobl
Copy link
Contributor

@web2033 well, it either works because ampersand was not present in path at package installation time or because you had yarn installed globally at installation time and create-adonis-ts-app uses the same technique of autodetecting global yarn and switching to it for build.

@Timsonrobl
Copy link
Contributor

This is an issue in npm, not an issue in vite.

Wait. I have it working with another project using npm - https://preview.adonisjs.com/guides/quick-start

npm init adonis-ts-app drag

then rename the folder to drag&drop

npm run dev

Works!

It seems to work with
npm run dev
but gives same error with
npm run start :

D:\CODE\apm&test\drag&drop>npm run start

> drag@1.0.0 start
> node server.js

node:internal/modules/cjs/loader:926
  throw err;
  ^

Error: Cannot find module 'D:\CODE\apm&test\drag&drop\server.js'
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:923:15)
    at Function.Module._load (node:internal/modules/cjs/loader:768:27)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:76:12)
    at node:internal/main/run_main_module:17:47 {
  code: 'MODULE_NOT_FOUND',
  requireStack: []
}
npm ERR! code 1
npm ERR! path D:\CODE\apm&test\drag&drop
npm ERR! command failed
npm ERR! command C:\WINDOWS\system32\cmd.exe /d /s /c node server.js

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Timson\AppData\Local\npm-cache\_logs\2021-03-27T20_26_18_741Z-debug.log

@ghost
Copy link
Author

ghost commented Mar 27, 2021

You cannot do the same trick with Vite as I did with npm init adonis-ts-app drag:

npm init @vitejs/app drag --template vue
cd drag
npm i

rename to drag&drop

npm run dev

Fail.

@Timsonrobl
Copy link
Contributor

Here is original issue npm/cmd-shim#45

@patak-dev patak-dev added bug: upstream Bug in a dependency of Vite and removed bug help wanted Extra attention is needed labels Mar 28, 2021
@Alexufo
Copy link

Alexufo commented Jul 24, 2021

The same error then html contain src without path. I suppose it is right behavior but bad debug messaging

@github-actions github-actions bot locked and limited conversation to collaborators Aug 13, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants