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

CI WSL Error: Cannot find module 'semver' #2737

Open
AndyOGo opened this issue Mar 16, 2023 · 13 comments
Open

CI WSL Error: Cannot find module 'semver' #2737

AndyOGo opened this issue Mar 16, 2023 · 13 comments

Comments

@AndyOGo
Copy link
Contributor

AndyOGo commented Mar 16, 2023

All jobs with WSL config fail on master.
https://ci.appveyor.com/project/ljharb/eslint-plugin-import/builds/46338908

E.g.:
https://ci.appveyor.com/project/ljharb/eslint-plugin-import/builds/46338908/job/hqyre5h5sbfqqn44

Error: Cannot find module 'semver'
Require stack:
- /mnt/c/projects/eslint-plugin-import/tests/src/cli.js
- /mnt/c/projects/eslint-plugin-import/node_modules/mocha/lib/mocha.js
- /mnt/c/projects/eslint-plugin-import/node_modules/mocha/index.js
- /mnt/c/projects/eslint-plugin-import/node_modules/mocha/bin/_mocha
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:1021:15)
    at Function.Module._load (node:internal/modules/cjs/loader:866:27)
    at Module.require (node:internal/modules/cjs/loader:1093:19)
    at require (node:internal/modules/cjs/helpers:108:18)
    at Object.<anonymous> (/mnt/c/projects/eslint-plugin-import/tests/src/cli.js:9:1)
    at Module._compile (node:internal/modules/cjs/loader:1191:14)
    at Module.replacementCompile (/mnt/c/projects/eslint-plugin-import/node_modules/nyc/node_modules/append-transform/index.js:58:13)
    at loader (/mnt/c/projects/eslint-plugin-import/node_modules/babel-register/lib/node.js:144:5)
    at require.extensions.<computed> (/mnt/c/projects/eslint-plugin-import/node_modules/babel-register/lib/node.js:154:7)
    at Object.<anonymous> (/mnt/c/projects/eslint-plugin-import/node_modules/nyc/node_modules/append-transform/index.js:62:4)
    at Module.load (node:internal/modules/cjs/loader:1069:32)
    at Function.Module._load (node:internal/modules/cjs/loader:904:12)
    at Module.require (node:internal/modules/cjs/loader:1093:19)
    at require (node:internal/modules/cjs/helpers:108:18)
    at /mnt/c/projects/eslint-plugin-import/node_modules/mocha/lib/mocha.js:231:27
    at Array.forEach (<anonymous>)
    at Mocha.loadFiles (/mnt/c/projects/eslint-plugin-import/node_modules/mocha/lib/mocha.js:228:14)
    at Mocha.run (/mnt/c/projects/eslint-plugin-import/node_modules/mocha/lib/mocha.js:514:10)
    at Object.<anonymous> (/mnt/c/projects/eslint-plugin-import/node_modules/mocha/bin/_mocha:480:18)
    at Module._compile (node:internal/modules/cjs/loader:1191:14)
    at Module.replacementCompile (/mnt/c/projects/eslint-plugin-import/node_modules/nyc/node_modules/append-transform/index.js:58:13)
    at module.exports (/mnt/c/projects/eslint-plugin-import/node_modules/nyc/node_modules/default-require-extensions/js.js:8:9)
    at /mnt/c/projects/eslint-plugin-import/node_modules/nyc/node_modules/append-transform/index.js:62:4
    at require.extensions.<computed> (/mnt/c/projects/eslint-plugin-import/node_modules/babel-register/lib/node.js:152:7)
    at Object.<anonymous> (/mnt/c/projects/eslint-plugin-import/node_modules/nyc/node_modules/append-transform/index.js:62:4)
    at Module.load (node:internal/modules/cjs/loader:1069:32)
    at Function.Module._load (node:internal/modules/cjs/loader:904:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
    at runMain (/home/appveyor/.node-spawn-wrap-41-9e09463faa5b/node:68:10)
    at Function.<anonymous> (/home/appveyor/.node-spawn-wrap-41-9e09463faa5b/node:171:5)
    at Object.<anonymous> (/mnt/c/projects/eslint-plugin-import/node_modules/nyc/bin/wrap.js:23:4)
    at Module._compile (node:internal/modules/cjs/loader:1191:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1245:10)
    at Module.load (node:internal/modules/cjs/loader:1069:32)
    at Function.Module._load (node:internal/modules/cjs/loader:904:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
    at /home/appveyor/.node-spawn-wrap-41-9e09463faa5b/node:178:8
    at Object.<anonymous> (/home/appveyor/.node-spawn-wrap-41-9e09463faa5b/node:181:3)
    at Module._compile (node:internal/modules/cjs/loader:1191:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1245:10)
    at Module.load (node:internal/modules/cjs/loader:1069:32)
    at Function.Module._load (node:internal/modules/cjs/loader:904:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
    at node:internal/main/run_main_module:22:47 {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/mnt/c/projects/eslint-plugin-import/tests/src/cli.js',
    '/mnt/c/projects/eslint-plugin-import/node_modules/mocha/lib/mocha.js',
    '/mnt/c/projects/eslint-plugin-import/node_modules/mocha/index.js',
    '/mnt/c/projects/eslint-plugin-import/node_modules/mocha/bin/_mocha'
  ]
}
@AndyOGo AndyOGo changed the title WSL Error: Cannot find module 'semver' CI WSL Error: Cannot find module 'semver' Mar 16, 2023
@ljharb
Copy link
Member

ljharb commented Mar 16, 2023

I'm aware of this, but I'm not sure what's causing it. I'd love a PR that can fix it (or alternatively, migrate windows tests to GHA).

@AndyOGo
Copy link
Contributor Author

AndyOGo commented Mar 16, 2023

mocha seems to make use of it 🤔

I found an issue over there from 2019, which is closed
mochajs/mocha#3868

That fix landed in v6.1.2.
https://github.com/mochajs/mocha/blob/283db20b3c203d3cb3b91919b1e36fbb7d764153/package.json#L3

Latest is 10.2.0

But mocha is far behind here.

npm ls mocha
eslint-plugin-import@2.27.5 /eslint-plugin-import
├─┬ eslint-import-resolver-node@0.3.7 -> ./resolvers/node
│ └── mocha@3.5.3 deduped
├─┬ eslint-import-resolver-webpack@0.13.2 -> ./resolvers/webpack
│ └── mocha@3.5.3 deduped
└── mocha@3.5.3

Anyway semver doesn't seem to be listed as a dependency of mocha 😕

npm list semver
eslint-plugin-import@2.27.5 /eslint-plugin-import
├─┬ @typescript-eslint/parser@5.55.0
│ └─┬ @typescript-eslint/typescript-estree@5.55.0
│   └── semver@7.3.8
├─┬ babel-plugin-istanbul@4.1.6
│ ├─┬ istanbul-lib-instrument@1.10.2
│ │ └── semver@5.7.1
│ └─┬ test-exclude@4.2.3
│   └─┬ read-pkg-up@1.0.1
│     └─┬ read-pkg@1.1.0
│       └─┬ normalize-package-data@2.5.0
│         └── semver@5.7.1
├─┬ babel-preset-airbnb@2.6.0
│ └─┬ babel-preset-env@1.7.0
│   └── semver@5.7.1
├─┬ eslint-doc-generator@1.4.3
│ └─┬ @typescript-eslint/utils@5.55.0
│   └── semver@7.3.8
├─┬ eslint-import-resolver-webpack@0.13.2 -> ./resolvers/webpack
│ └── semver@5.7.1
├─┬ eslint-plugin-import@2.27.5
│ └── semver@6.3.0 deduped
├─┬ nyc@11.9.0
│ ├─┬ istanbul-lib-instrument@1.10.1
│ │ └── semver@5.5.0
│ └─┬ test-exclude@4.2.1
│   └─┬ read-pkg-up@1.0.1
│     └─┬ read-pkg@1.1.0
│       └─┬ normalize-package-data@2.4.0
│         └── semver@5.5.0 deduped
├─┬ safe-publish-latest@2.0.0
│ └── semver@7.3.8
├── semver@6.3.0
└─┬ typescript-eslint-parser@22.0.0
  └─┬ typescript-estree@18.0.0
    └── semver@5.5.0

@AndyOGo
Copy link
Contributor Author

AndyOGo commented Mar 16, 2023

I cloned mocha and checked out the v3.5.3 tag

npm list -prod semver
mocha@3.5.3 /mocha
└── (empty)
npm list -dev semver
mocha@3.5.3 /mocha
├─┬ karma@1.3.0
│ └─┬ log4js@0.6.38
│   └── semver@4.3.6
├─┬ nyc@11.9.0
│ ├─┬ istanbul-lib-instrument@1.10.1
│ │ └── semver@5.5.0
│ └─┬ test-exclude@4.2.1
│   └─┬ read-pkg-up@1.0.1
│     └─┬ read-pkg@1.1.0
│       └─┬ normalize-package-data@2.4.0
│         └── semver@5.5.0 deduped
├─┬ os-name@2.0.1
│ └─┬ win-release@1.1.1
│   └── semver@5.7.1
└─┬ phantomjs@1.9.8
  └─┬ npmconf@0.0.24
    └── semver@1.1.4

@ljharb
Copy link
Member

ljharb commented Mar 16, 2023

Yes, we're stuck on mocha v3. Does that depend on node-environment-flags? Maybe a workaround is to manually install a fixed version of it.

@AndyOGo
Copy link
Contributor Author

AndyOGo commented Mar 16, 2023

I missed the obvious.

semver is installed and utilized by no-duplicates:

import semver from 'semver';

@ljharb
Copy link
Member

ljharb commented Mar 16, 2023

Good call, and it's in the project's dependencies, so there's no reason it shouldn't be present.

@AndyOGo
Copy link
Contributor Author

AndyOGo commented Mar 16, 2023

@ljharb
Copy link
Member

ljharb commented Mar 16, 2023

All of that is handled in appveyor.yml - PRs are quite welcome :-)

@AndyOGo
Copy link
Contributor Author

AndyOGo commented Mar 16, 2023

I created just a workaround and excluded the remaining WSL jobs.

A proper solution is still required.

@ljharb
Copy link
Member

ljharb commented Mar 16, 2023

I prefer to leave them failing rather than skip them.

@AndyOGo
Copy link
Contributor Author

AndyOGo commented Mar 17, 2023

I understand.
It is what is and has a bitter taste.
I closed them.

@AndyOGo
Copy link
Contributor Author

AndyOGo commented Mar 17, 2023

@ljharb
I tried to install it via nvm as suggested here, but that failed miserably.
https://learn.microsoft.com/en-us/windows/dev-environment/javascript/nodejs-on-wsl#install-nvm-nodejs-and-npm

@AndyOGo
Copy link
Contributor Author

AndyOGo commented Mar 21, 2023

https://help.appveyor.com/discussions/problems/34173-cant-test-nodejs-on-wsl

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Development

Successfully merging a pull request may close this issue.

2 participants