jacobparis-insiders / sly

Monorepo for Sly CLI
https://sly-cli.fly.dev/
153 stars 11 forks source link

Bug: Module Not Found Error in Sly #50

Closed jinto-ag closed 5 days ago

jinto-ag commented 5 months ago

Title:

Module Not Found Error in Sly

Description:

When running the npx sly add command, I encountered a Module Not Found error. The error message suggests that the module 'C:\Users\Software' could not be found. This issue occurred on a Windows machine.

Steps to Reproduce:

  1. Navigate to the project directory in the terminal.
  2. Run the command npx sly add.

Expected Behavior:

The command should execute without any errors.

Actual Behavior:

The command fails with the following error:

(node:14264) ExperimentalWarning: `--experimental-loader` may be removed in the future; instead use `register()`:
--import 'data:text/javascript,import { register } from "node:module"; import { pathToFileURL } from "node:url"; register("%40sly-cli/sly/ts-loader", pathToFileURL("./"));'
(Use `node --trace-warnings ...` to show where the warning was created)

node:internal/process/esm_loader:34
      internalBinding('errors').triggerUncaughtException(
                                ^
Error [ERR_MODULE_NOT_FOUND]: Cannot find module 'C:\Users\Software' imported from C:\Users\Software Developer\Documents\xxx\projects\xxx-in\source_code\xxx-in\
    at finalizeResolution (node:internal/modules/esm/resolve:264:11)
    at moduleResolve (node:internal/modules/esm/resolve:917:10)
    at defaultResolve (node:internal/modules/esm/resolve:1130:11)
    at nextResolve (node:internal/modules/esm/hooks:865:28)
    at Hooks.resolve (node:internal/modules/esm/hooks:303:30)
    at MessagePort.handleMessage (node:internal/modules/esm/worker:196:24)
    at [nodejs.internal.kHybridDispatch] (node:internal/event_target:826:20)
    at exports.emitMessage (node:internal/per_context/messageport:23:28) {
  code: 'ERR_MODULE_NOT_FOUND',
  url: 'file:///C:/Users/Software'
}

Node.js v20.11.1

Environment:

Additional Context:

This issue seems to be related to the handling of file paths on Windows, particularly those with spaces. The error message suggests that the path is being cut off at the first space ('C:\Users\Software'), which might be causing the issue.

MrOxMasTer commented 1 month ago

The same thing

> npx @sly-cli/sly add

node:internal/modules/run_main:129
    triggerUncaughtException(
    ^
Error [ERR_MODULE_NOT_FOUND]: Cannot find module 'C:\Users\...\OneDrive\Рабочий' imported from C:\Users\...\OneDrive\Рабочий стол\PetProjects\shopco\
    at finalizeResolution (node:internal/modules/esm/resolve:265:11)
    at moduleResolve (node:internal/modules/esm/resolve:933:10)
    at defaultResolve (node:internal/modules/esm/resolve:1157:11)
    at nextResolve (node:internal/modules/esm/hooks:866:28)
    at Hooks.resolve (node:internal/modules/esm/hooks:304:30)
    at MessagePort.handleMessage (node:internal/modules/esm/worker:196:24)
    at [nodejs.internal.kHybridDispatch] (node:internal/event_target:820:20)
    at MessagePort.<anonymous> (node:internal/per_context/messageport:23:28) {
  code: 'ERR_MODULE_NOT_FOUND',
  url: 'file:///C:/Users/%D0%90%D0%BB%D0%B5%D0%BA%D1%81%D0%B5%D0%B9/OneDrive/%D0%A0%D0%B0%D0%B1%D0%BE%D1%87%D0%B8%D0%B9'    
}

Node.js v20.15.0

With pnpm

> pnpm dlx @sly-cli/sly add

error: unknown command 'стол\PetProjects\shopco'
 *  Terminal will be reused by tasks, press any key to close it. 
MrOxMasTer commented 1 month ago

Perhaps the problem is due to the fact that in English the desktop is like one word, and in Cyrillic as 2 words - "Рабочий стол". Because of this, the problem is in the paths

MrOxMasTer commented 3 weeks ago

There is still a guess as to why this is happening. Because of the user name windows written in Cyrillic. I switched to a laptop and everything works

jacobparis commented 3 weeks ago

Hey, sorry about this – I don't have access to a Windows machine to debug. I've gone over everywhere that I'm importing a dynamic path and it's using the getFileURLToPath which is meant to be cross platform (even includes an example of filename with spaces)

image
jacobparis commented 3 weeks ago

I made a couple tweaks to the shell spawning in 1.14.0, hopefully that helps here

MrOxMasTer commented 3 weeks ago

I made a couple tweaks to the shell spawning in 1.14.0, hopefully that helps here

Unfortunately, I have other equipment right now that doesn't have this problem and I can't test. Only in about a week I will be able to answer and tell you. Did you get the fix

MrOxMasTer commented 2 weeks ago

I made a couple tweaks to the shell spawning in 1.14.0, hopefully that helps here

image

Even on version 1.13.0

MrOxMasTer commented 2 weeks ago

Updated to version 1.14 and it still works

jinto-ag commented 5 days ago

@jacobparis thank you for the response. I finally figured out that the space in the folder name caused the issue. The issue has been resolved.