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 10 #20

Closed
starnayuta opened this issue Feb 3, 2024 · 1 comment · Fixed by #21
Closed

Not working on Windows 10 #20

starnayuta opened this issue Feb 3, 2024 · 1 comment · Fixed by #21
Labels
Type: Bug Bug or Bug fixes

Comments

@starnayuta
Copy link
Contributor

starnayuta commented Feb 3, 2024

I got an error on my Windows 10 computer when I tried to run eslint.

PS C:\path\to\repository> npx eslint-cjs-to-esm "./src/**/*.{js,ts}"
C:\path\to\repository\node_modules\.bin\eslint:2
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
          ^^^^^^^

SyntaxError: missing ) after argument list
    at internalCompileFunction (node:internal/vm:77:18)
    at wrapSafe (node:internal/modules/cjs/loader:1288:20)
    at Module._compile (node:internal/modules/cjs/loader:1340:27)
    at Module._extensions..js (node:internal/modules/cjs/loader:1435:10)
    at Module.load (node:internal/modules/cjs/loader:1207:32)
    at Module._load (node:internal/modules/cjs/loader:1023:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:135:12)
    at node:internal/main/run_main_module:28:49

Node.js v20.11.0

An error is occurring in the execution of the eslint sh file.

https://github.com/azu/eslint-cjs-to-esm/blob/main/eslint-cjs-to-esm.js#L6

I am not familiar with how eslint or npm bin works, but it seems that on Windows bat files are used instead of sh files.

image

Similar Issues:

@starnayuta
Copy link
Contributor Author

I tried changing the path with reference to a similar Issue and got another error.

I will try another way.
It may be acceptable to run eslint on npx, as this is a temporary migration library.

- const eslintBin = require.resolve(".bin/eslint");
+ const eslintBin = require.resolve("eslint/bin/eslint.js");
C:\path\to\repository>npx eslint-cjs-to-esm "./src/**/*.{js,ts}"
node:internal/modules/esm/resolve:303
  return new ERR_PACKAGE_PATH_NOT_EXPORTED(
         ^

Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './bin/eslint.js' is not defined by "exports" in C:\path\to\repository\node_modules\eslint\package.json
    at exportsNotFound (node:internal/modules/esm/resolve:303:10)
    at packageExportsResolve (node:internal/modules/esm/resolve:650:9)
    at resolveExports (node:internal/modules/cjs/loader:591:36)
    at Module._findPath (node:internal/modules/cjs/loader:668:31)
    at Module._resolveFilename (node:internal/modules/cjs/loader:1130:27)
    at Function.resolve (node:internal/modules/helpers:187:19)
    at file:///C:/path/to/repository/node_modules/eslint-cjs-to-esm/eslint-cjs-to-esm.js:7:27
    at ModuleJob.run (node:internal/modules/esm/module_job:218:25)
    at async ModuleLoader.import (node:internal/modules/esm/loader:329:24)
    at async loadESM (node:internal/process/esm_loader:28:7) {
  code: 'ERR_PACKAGE_PATH_NOT_EXPORTED'
}

Node.js v20.11.0

Similar Issues:

@azu azu added the Type: Bug Bug or Bug fixes label Feb 3, 2024
@azu azu closed this as completed in #21 Feb 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Bug or Bug fixes
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants