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

Not working on Windows (white space problem?) #40

Closed
mehdi-cit opened this issue May 29, 2023 · 14 comments
Closed

Not working on Windows (white space problem?) #40

mehdi-cit opened this issue May 29, 2023 · 14 comments
Assignees
Labels
help wanted Extra attention is needed wontfix This will not be worked on

Comments

@mehdi-cit
Copy link

Hello,
I'm unable to make the sample app work on my Windows 10 machine. From the command line output ('C:\Users\Windows' is not recognized as an internal or external command, operable program or batch file.) it seems to be related to a white space in the path (Full output is found below).

`C:\Code\socketsupply-test> yarn create socket-app react
yarn create v1.22.19
warning package.json: No license field
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...

success Installed "[email protected]" with binaries:
      - create-socket-app
'C:\Users\Windows' is not recognized as an internal or external command,
operable program or batch file.
error Command failed.
Exit code: 1
Command: C:\Users\Windows 10\AppData\Local\Yarn\bin\create-socket-app
Arguments: react
Directory: C:\Code\socketsupply-test
Output:

info Visit https://yarnpkg.com/en/docs/cli/create for documentation about this command.
`
 
@mribbons mribbons self-assigned this May 30, 2023
@mribbons mribbons added the help wanted Extra attention is needed label May 30, 2023
@mribbons
Copy link
Contributor

mribbons commented May 30, 2023

Hey @mehdi-cit,
It is indeed a space issue.

We could attempt to fix this, but you will run into other issues, not just with socket, if you persist with spaces in paths.

Therefore, I recommend that you change your npm prefix folder to a different folder.
I have tested the commands below with npm only, but I have added yarn for your convenience. Let me know if this doesn't work:

mkdir c:\node
npm config set -g prefix c:\node
mkdir c:\projects\app
cd c:\projects\app
yarn create socket-app react
yarn start

@mehdi-cit
Copy link
Author

mehdi-cit commented May 30, 2023

Thank you much @mribbons
Tried to follow your instructions. First with yarn and then with npx. Both failed with different messages. Below is the output:
`
PS C:\projects\app> yarn create create-socket-app react
yarn create v1.22.19
[1/4] Resolving packages...
error An unexpected error occurred: "https://registry.yarnpkg.com/create-create-socket-app: Not found".
info If you think this is a bug, please open a bug report with the information provided in "C:\Users\Windows 10\AppData\Local\Yarn\Data\global\yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/create for documentation about this command.
PS C:\projects\app> npx create-socket-app react
node:internal/process/promises:279
triggerUncaughtException(err, true /* fromPromise */);
^

[Error: ENOENT: no such file or directory, scandir 'C:\Users\Windows%2010\AppData\Local\Yarn\Data\global\node_modules\create-socket-app\templates'] {
errno: -4058,
code: 'ENOENT',
syscall: 'scandir',
path: 'C:\Users\Windows%2010\AppData\Local\Yarn\Data\global\node_modules\create-socket-app\templates'
}
`
Notice that I only tried yarn after npx failed (the failure message was the same as the second one above. i.e. triggerUncaughtException(err, ... ).

Thank you again for sticking with me

@mribbons
Copy link
Contributor

My mistake, the instructions were incorrect for yarn, should be:

yarn create socket-app react

I have tested with yarn now and it works. I did need to update my PATH after the npm prefix change to find yarn, but you seem to be running it fine.

@mehdi-cit
Copy link
Author

mehdi-cit commented May 31, 2023

Thank you again... I feel stupid but it still doesn't work. It seems the white space problem persists. PS: I too did update the PATH.
Below is the command line output:

PS C:\projects\app> yarn create socket-app react
yarn create v1.22.19 [1/4] Resolving packages... [2/4] Fetching packages... [3/4] Linking dependencies... [4/4] Building fresh packages... success Installed "[email protected]" with binaries: - create-socket-app [####################] 20/20'C:\Users\Windows' is not recognized as an internal or external command, operable program or batch file. error Command failed. Exit code: 1

@mribbons
Copy link
Contributor

Hi @mehdi-cit,
I did a bit more research, it looks as though you'll also need to update your Yarn global path:
https://classic.yarnpkg.com/lang/en/docs/cli/global/

Please try:

mkdir c:\yarn\global\bin
yarn config set prefix c:\yarn\global\bin

Then add c:\yarn\global\bin to your path and try again from the to.

@mehdi-cit
Copy link
Author

@mribbons thanks a million.
I did as per your instructions and it did move the needle. But now yarn is basically throwing the same error as npx (I switched the yarn in the first place to circumvent that error).
Here's the command line output:
`
PS C:\projects\app> yarn create socket-app react

yarn create v1.22.19
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...
success Installed "[email protected]" with binaries:
- create-socket-app
[####################] 20/20node:internal/process/promises:279
triggerUncaughtException(err, true /* fromPromise */);
^

[Error: ENOENT: no such file or directory, scandir 'c:\Users\Windows%2010\AppData\Local\Yarn\Data\global\node_modules\create-socket-app\templates'] {
errno: -4058,
code: 'ENOENT',
syscall: 'scandir',
path: 'c:\Users\Windows%2010\AppData\Local\Yarn\Data\global\node_modules\create-socket-app\templates'
}
error Command failed.
Exit code: 1
Command: c:\yarn\global\bin\bin\create-socket-app
Arguments: react
Directory: C:\projects\app
Output:

info Visit https://yarnpkg.com/en/docs/cli/create for documentation about this command.
`

@mribbons
Copy link
Contributor

No problem @mehdi-cit
It looks as though yarn is still using the copy under your user folder.
Without your exact setup it's not easy to debug.
You could try moving this folder elsewhere so yarn doesn't try to use it
c:\Users\Windows 10\AppData\Local\Yarn\Data\global\node_modules\create-socket-app
If you haven't already, try from a fresh ps terminal, there may be path related stuff pointing to the previous yarn configuration.

@mribbons
Copy link
Contributor

As per https://classic.yarnpkg.com/lang/en/docs/cli/global,
Check:

yarn global dir

@mehdi-cit
Copy link
Author

I thought about re-installing node/npm/yarn and the whole chabang but that doesn't solve the original problem which many more Windows user might encounter. Hence, it's best to tackle it at its root or at least document here how to fix/mitigate it!

@mribbons
Copy link
Contributor

I considered fixing it, but in my experience you will eventually encounter more issues when either dev tools, or source files are under paths that contain spaces.

In order to test a solution, we're going to need to set up virtual machines that match your environment. That can be done, but we'll need to fit it in with other priorities.

We can leave this issue open, but let's focus on a workaround for now.

@mehdi-cit
Copy link
Author

I thought this comes from some of socketsupply's code/scripts calling installed software. Maybe enclosing such calls within quotes when Windows machine is detected! Just a tought. I might be off track here!
Concerning my specific use case! I can use a different PC or re-install everything as I said. However, this problem may persist for other windows users!
Thank you again

@mehdi-cit
Copy link
Author

@mribbons
Ok this seems to be working (at least I see not errors so far, it's almost midnight here and I need to go to sleep).
I had to use the command line to setup the yarn directory.
yarn config set global-folder "C:\where-ever\you-set-yarn"

@mribbons mribbons added the wontfix This will not be worked on label May 31, 2023
@mribbons
Copy link
Contributor

Closing as it is a general issue with yarn.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

2 participants