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

Error when generating a plugin #1368

Closed
bertdeblock opened this issue Aug 29, 2023 · 0 comments
Closed

Error when generating a plugin #1368

bertdeblock opened this issue Aug 29, 2023 · 0 comments

Comments

@bertdeblock
Copy link

bertdeblock commented Aug 29, 2023

❯ npx checkup generate plugin bar
CheckupError: An unknown error has occurred.
    at Generator.generate (file:///Users/foo/Code/bar/projects/oase/oase-front-end/node_modules/@checkup/cli/lib/api/generator.js:44:19)
    at async Generator.run (file:///Users/foo/Code/bar/projects/oase/oase-front-end/node_modules/@checkup/cli/lib/api/generator.js:20:9)
    at async Object.handler (file:///Users/foo/Code/bar/projects/oase/oase-front-end/node_modules/@checkup/cli/lib/commands/generate/plugin.js:31:9) {
  details: {
    message: [Function: message],
    callToAction: [Function: callToAction],
    errorCode: 1
  },
  options: {
    error: file:///Users/foo/Code/bar/projects/oase/oase-front-end/node_modules/@checkup/cli/lib/generators/plugin.js:3
    import { readJsonSync } from 'fs-extra';
             ^^^^^^^^^^^^
    SyntaxError: Named export 'readJsonSync' not found. The requested module 'fs-extra' is a CommonJS module, which may not support all module.exports as named exports.
    CommonJS modules can always be imported via the default export, for example using:

    import pkg from 'fs-extra';
    const { readJsonSync } = pkg;

        at ModuleJob._instantiate (node:internal/modules/esm/module_job:123:21)
        at async ModuleJob.run (node:internal/modules/esm/module_job:189:5)
        at async Promise.all (index 0)
        at async ESMLoader.import (node:internal/modules/esm/loader:526:24)
        at async importModuleDynamicallyWrapper (node:internal/vm/module:438:15)
        at async instantiateAndRun (/Users/foo/Code/bar/projects/oase/oase-front-end/node_modules/yeoman-environment/lib/environment.js:1096:25)
        at async Generator.generate (file:///Users/foo/Code/bar/projects/oase/oase-front-end/node_modules/@checkup/cli/lib/api/generator.js:32:13)
        at async Generator.run (file:///Users/foo/Code/bar/projects/oase/oase-front-end/node_modules/@checkup/cli/lib/api/generator.js:20:9)
        at async Object.handler (file:///Users/foo/Code/bar/projects/oase/oase-front-end/node_modules/@checkup/cli/lib/commands/generate/plugin.js:31:9)
  }
}

Seems like:

import { readJsonSync } from 'fs-extra';

readJsonSync(...);

should be:

import fsExtra from 'fs-extra';

fsExtra.readJsonSync(...);
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

Successfully merging a pull request may close this issue.

1 participant