percy / percy-migrate-sdk

@percy/migrate is used to upgrade and migrate your Percy SDK to the latest version.
MIT License
1 stars 0 forks source link

Migrating to Percy CLI not working #289

Closed Jamesking56 closed 2 years ago

Jamesking56 commented 2 years ago

The problem

When trying to upgrade my Percy setup to use Percy CLI (following docs: https://docs.percy.io/docs/migrating-to-percy-cli), the migrate command fails with an error:

$ npx @percy/migrate
npx: installed 144 in 4.92s
Must use import to load ES Module: /home/james.king/.npm/_npx/20716/lib/node_modules/@percy/migrate/node_modules/@percy/config/dist/index.js
require() of ES modules is not supported.
require() of /home/james.king/.npm/_npx/20716/lib/node_modules/@percy/migrate/node_modules/@percy/config/dist/index.js from /home/james.king/.npm/_npx/20716/lib/node_modules/@percy/migrate/dist/index.js is an ES module file as it is a .js file whose nearest parent package.json contains "type": "module" which defines all .js files in that package scope as ES modules.
Instead rename /home/james.king/.npm/_npx/20716/lib/node_modules/@percy/migrate/node_modules/@percy/config/dist/index.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from /home/james.king/.npm/_npx/20716/lib/node_modules/@percy/migrate/node_modules/@percy/config/package.json.

Environment

Details

I'm trying to upgrade the config file on my personal website which is public on GitHub here: https://github.com/Jamesking56/jamesking.dev

Jamesking56 commented 2 years ago

Further to this, I changed the GitHub Actions workflow to use the new CLI and that also has a strange error:

https://github.com/Jamesking56/jamesking.dev/runs/6171352445?check_suite_focus=true

Jamesking56 commented 2 years ago

Tried the same migration tool in Node v16 and Node v18 and the same error still occurs