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

tsconfig/base.json file missing in v0.12.2 #218

Open
ivanmihaljevicdiageo opened this issue May 22, 2024 · 10 comments
Open

tsconfig/base.json file missing in v0.12.2 #218

ivanmihaljevicdiageo opened this issue May 22, 2024 · 10 comments

Comments

@ivanmihaljevicdiageo
Copy link

Describe the bug

In ADO pipeline, I run npm install -g @unlighthouse/cli puppeteer and unlighthouse-ci --site $(deploymentUrl) --config-file unlighthouse-desktop.config.ts --debug --output-path $(System.DefaultWorkingDirectory)/$(VERCEL_PROJECT_NAME)-lighthouse. Since 0.12.2 release, I get this error:

Screenshot 2024-05-22 at 13 18 29

Reverting to v0.12.1 solves the issue

Reproduction

No response

System / Nuxt Info

No response

@y2gabs
Copy link

y2gabs commented May 22, 2024

getting an error since upgrading to 12.2 this morning that I think is related here. My unlighthouse.config file was working great before upgrading:

(node:691801) Warning: To load an ES module, set "type": "module" in the package.json or use the .mjs extension.
(Use node --trace-warnings ... to show where the warning was created)
/home/folder/unlighthouse.config.ts:1
export default {
^^^^^^

SyntaxError: Unexpected token 'export'
at internalCompileFunction (node:internal/vm:76:18)
at wrapSafe (node:internal/modules/cjs/loader:1283:20)
at Module._compile (node:internal/modules/cjs/loader:1328:27)
at Module._extensions..js (node:internal/modules/cjs/loader:1422:10)
at Module.load (node:internal/modules/cjs/loader:1203:32)
at Module._load (node:internal/modules/cjs/loader:1019:12)
at ModuleWrap. (node:internal/modules/esm/translators:203:29)
at ModuleJob.run (node:internal/modules/esm/module_job:195:25)
at async ModuleLoader.import (node:internal/modules/esm/loader:337:24)
at async Module.loader (file:https:///home/folder/.npm/_npx/944abecbf21dfffb/node_modules/importx/dist/chunks/tsx.mjs:22:10)

Node.js v18.20.2

@mountainash
Copy link
Contributor

Also getting the same error as @y2gabs Running latest with npm add -g @unlighthouse/cli puppeteer then unlighthouse-ci --config-file unlighthouse.config.ts on GitHub Actions ubuntu-22.04 default image.

Will revert to the previous version with npm add -g @unlighthouse/[email protected] puppeteer

@harlan-zw
Copy link
Owner

harlan-zw commented May 22, 2024

Thank you for the reports, I'm trying to replicate but having issues. I'm not exactly sure what's going on, maybe related to an upstream dependency or 0c6a0eb.

Could you try npx unlighthouse-ci --config-file unlighthouse.config.ts? This should be all that's needed within a CI now but I need to test further.

@mountainash
Copy link
Contributor

@harlan-zw it's the same issue using npx directly:

Run npx unlighthouse-ci --config-file unlighthouse.config.ts
npm WARN exec The following package was not found and will be installed: [email protected]
(node:1525) Warning: To load an ES module, set "type": "module" in the package.json or use the .mjs extension.
(Use `node --trace-warnings ...` to show where the warning was created)
Error:  Unexpected token 'export'
  export default {
  ^^^^^^
  
  SyntaxError: Unexpected token 'export'
  at internalCompileFunction (node:internal/vm:76:18)
  at wrapSafe (node:internal/modules/cjs/loader:1283:20)
  at Module._compile (node:internal/modules/cjs/loader:1328:27)
  at Module._extensions..js (node:internal/modules/cjs/loader:1[4](https://github.com/ginetta/client-cta-website/actions/runs/9192724803/job/25289405921#step:3:5)22:10)
  at Module.load (node:internal/modules/cjs/loader:1203:32)
  at Module._load (node:internal/modules/cjs/loader:1019:12)
  at ModuleWrap.<anonymous> (node:internal/modules/esm/translators:203:29)
  at ModuleJob.run (node:internal/modules/esm/module_job:19[5](https://github.com/ginetta/client-cta-website/actions/runs/9192724803/job/25289405921#step:3:6):25)
  at async ModuleLoader.import (node:internal/modules/esm/loader:337:24)
  at async Module.loader (/home/runner/.npm/_npx/b17dc438925[6](https://github.com/ginetta/client-cta-website/actions/runs/9192724803/job/25289405921#step:3:7)a785/node_modules/importx/dist/chunks/tsx.mjs:22:10)
Error: Process completed with exit code 1.

@y2gabs
Copy link

y2gabs commented May 22, 2024

Forgot to mention that I'm using npx directly too. I just specify 0.12.1 in my scan and it works for now. This is such a great tool so thank you for all you do!

@mountainash
Copy link
Contributor

mountainash commented May 23, 2024

@y2gabs how are you doing that? (what command)? As unlighthouse-ci has only existed since v0.12.2 https://www.npmjs.com/package/unlighthouse-ci?activeTab=versions. npx [email protected] will not work. I'm guessing you are doing npx @unlighthouse/[email protected]?

@y2gabs
Copy link

y2gabs commented May 23, 2024

Using it in bash - npx [email protected]

@y2gabs
Copy link

y2gabs commented May 24, 2024

weird hit & miss issues running 0.12.1 this week unfortunately. Scan only seems to run half the time, the other half it seems to hang during the scan. Weird

@mwskwong
Copy link

mwskwong commented Jun 19, 2024

@harlan-zw it's the same issue using npx directly:

Run npx unlighthouse-ci --config-file unlighthouse.config.ts
npm WARN exec The following package was not found and will be installed: [email protected]
(node:1525) Warning: To load an ES module, set "type": "module" in the package.json or use the .mjs extension.
(Use `node --trace-warnings ...` to show where the warning was created)
Error:  Unexpected token 'export'
  export default {
  ^^^^^^
  
  SyntaxError: Unexpected token 'export'
  at internalCompileFunction (node:internal/vm:76:18)
  at wrapSafe (node:internal/modules/cjs/loader:1283:20)
  at Module._compile (node:internal/modules/cjs/loader:1328:27)
  at Module._extensions..js (node:internal/modules/cjs/loader:1[4](https://github.com/ginetta/client-cta-website/actions/runs/9192724803/job/25289405921#step:3:5)22:10)
  at Module.load (node:internal/modules/cjs/loader:1203:32)
  at Module._load (node:internal/modules/cjs/loader:1019:12)
  at ModuleWrap.<anonymous> (node:internal/modules/esm/translators:203:29)
  at ModuleJob.run (node:internal/modules/esm/module_job:19[5](https://github.com/ginetta/client-cta-website/actions/runs/9192724803/job/25289405921#step:3:6):25)
  at async ModuleLoader.import (node:internal/modules/esm/loader:337:24)
  at async Module.loader (/home/runner/.npm/_npx/b17dc438925[6](https://github.com/ginetta/client-cta-website/actions/runs/9192724803/job/25289405921#step:3:7)a785/node_modules/importx/dist/chunks/tsx.mjs:22:10)
Error: Process completed with exit code 1.

I'm able to reproduce the Unexpected token 'export' issue as well with v0.13.1 (the latest as of this comment is made), but not with npx unlighthouse-ci. It seems starting to appear from v0.12.2.

Failed GitHub Action FYR: https://github.com/mwskwong/mwskwong.com/actions/runs/9573986998/job/26396439815

Workflow

name: Unlighthouse
on: deployment_status

jobs:
  unlighthouse:
    if: github.event_name == 'deployment_status' && github.event.deployment_status.state == 'success'
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v4
      - run: npm install -g @unlighthouse/cli puppeteer
      - run: npm list -g @unlighthouse/cli
      - run: unlighthouse-ci --site ${{ github.event.deployment_status.environment_url }}
      - uses: actions/upload-artifact@v4
        if: always()
        with:
          path: ./.unlighthouse

unlighthouse.config.ts

export default {
  cache: false,
  ci: {
    buildStatic: true,
    budget: {
      performance: 95,
      accessibility: 92,
      'best-practices': 100,
      seo: 66,
    },
  },
  scanner: {
    samples: 5,
  },
};

@ivanmihaljevicdiageo
Copy link
Author

@harlan-zw Running npx unlighthouse-ci --config-file unlighthouse.config.ts only works if an older version(0.12.1 or lower) is already installed.

In my case, I'm running VM scale sets in ADO. If a job is in the queue for 5 minutes, new VM is provisioned. In this scenario npx unlighthouse-ci --config-file unlighthouse.config.ts fails with the error that others have mentioned because Unlighthouse can't be installed.

However, if I run npm install -g @unlighthouse/[email protected] puppeteer in the first run after provisioning the agent, npx unlighthouse-ci --config-file unlighthouse.config.ts works in subsequent runs.

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

No branches or pull requests

5 participants