N
Nuxt3mo ago
bauti

Cant get nuxt-eslint to work on bitbucket pipelines

Hello! Could anyone help me with setting up nuxt on bitbucket pipelines? A step of my pipeline is npm run lint (it runs after npm install) but when the lint runs, it throws this error:
- step: &install
name: 'Install Dependencies'
caches:
- node
script:
- npm install
- step: &lint
name: 'Lint'
caches:
- node
script:
- npm run lint
- step: &install
name: 'Install Dependencies'
caches:
- node
script:
- npm install
- step: &lint
name: 'Lint'
caches:
- node
script:
- npm run lint
+ npm run lint
> lint
> eslint .
Oops! Something went wrong! :(
ESLint: 8.57.0
Error [ERR_MODULE_NOT_FOUND]: Cannot find module '/opt/atlassian/pipelines/agent/build/.nuxt/eslint.config.mjs' imported from /opt/atlassian/pipelines/agent/build/eslint.config.mjs
at new NodeError (node:internal/errors:405:5)
at finalizeResolution (node:internal/modules/esm/resolve:327:11)
at moduleResolve (node:internal/modules/esm/resolve:980:10)
at defaultResolve (node:internal/modules/esm/resolve:1193:11)
at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:404:12)
at ModuleLoader.resolve (node:internal/modules/esm/loader:373:25)
at ModuleLoader.getModuleJob (node:internal/modules/esm/loader:250:38)
at ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:76:39)
at link (node:internal/modules/esm/module_job:75:36)
+ npm run lint
> lint
> eslint .
Oops! Something went wrong! :(
ESLint: 8.57.0
Error [ERR_MODULE_NOT_FOUND]: Cannot find module '/opt/atlassian/pipelines/agent/build/.nuxt/eslint.config.mjs' imported from /opt/atlassian/pipelines/agent/build/eslint.config.mjs
at new NodeError (node:internal/errors:405:5)
at finalizeResolution (node:internal/modules/esm/resolve:327:11)
at moduleResolve (node:internal/modules/esm/resolve:980:10)
at defaultResolve (node:internal/modules/esm/resolve:1193:11)
at ModuleLoader.defaultResolve (node:internal/modules/esm/loader:404:12)
at ModuleLoader.resolve (node:internal/modules/esm/loader:373:25)
at ModuleLoader.getModuleJob (node:internal/modules/esm/loader:250:38)
at ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:76:39)
at link (node:internal/modules/esm/module_job:75:36)
I tried it locally, in windows, and on ubuntu, and in both the lint worked fine what can it be?
1 Reply
Cue
Cue3mo ago
Add - npm install before - npm run lint also. You’re caching node, but that doesn’t place the node modules into your step. You still need to run install, so it knows to install from cache if it exists. Hope that makes sense