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: exports is not defined in ES module scope when running npm run dev:with-minio #2823

Closed
Shreyas2309 opened this issue Jan 2, 2025 · 4 comments
Assignees
Labels
bug Something isn't working dependencies Pull requests that update a dependency file

Comments

@Shreyas2309
Copy link

Describe the bug

When running the npm run dev:with-minio command, an error occurs because the exports keyword is not defined in ES module scope. This is caused by the project's "type": "module" setting in package.json conflicting with the CommonJS syntax in minioInstallationCheck.js.

To Reproduce
Steps to reproduce the behavior:

  1. Clone the Talawa-API repository.
  2. Navigate to the project directory.
  3. Run npm install to install dependencies.
  4. Execute the command npm run dev:with-minio.

Expected behavior
The npm run dev:with-minio command should execute without errors, successfully validating MinIO setup and starting the API server.

Actual behavior
The command fails with the following error:

file:///C:/Shreyas/Project/talawa-api/build/minioInstallationCheck.js:49
Object.defineProperty(exports, "__esModule", { value: true });
^
ReferenceError: exports is not defined in ES module scope
This file is being treated as an ES module because it has a '.js' file extension and 'C:\Shreyas\Project\talawa-api\package.json' contains "type": "module". To treat it as a CommonJS script, rename it to use the '.cjs' file extension.

Screenshots
image

Additional details
The error occurs because the minioInstallationCheck.js file is treated as an ES module due to the "type": "module" configuration in package.json, but it uses CommonJS syntax (exports).

Suggested Fix
Convert minioInstallationCheck.js to ES module syntax by replacing exports with export default or named exports.

Potential internship candidates

Please read this if you are planning to apply for a Palisadoes Foundation internship

@Shreyas2309 Shreyas2309 added the bug Something isn't working label Jan 2, 2025
@github-actions github-actions bot added dependencies Pull requests that update a dependency file unapproved Unapproved for Pull Request labels Jan 2, 2025
@vaibhavgarg25
Copy link

vaibhavgarg25 commented Jan 2, 2025

I would like to work on this issue .could you assign me.

@dhanagopu dhanagopu removed the unapproved Unapproved for Pull Request label Jan 2, 2025
@mdimado
Copy link

mdimado commented Jan 2, 2025

I’d like to work on this issue. Could you please assign it to me?

My plan is to start by converting minioInstallationCheck.js to ES Module syntax since the project seems to be set up for ESM. If this doesn't work, I can try treating the file as CommonJS by renaming it

@vaibhavgarg25
Copy link

vaibhavgarg25 commented Jan 3, 2025

@Shreyas2309 @palisadoes @dhanagopu . I actually cloned the entire repository and set it up perfectly . And on running npm run dev : with-minio I don't get this error message . Could you just guide me over it .

@palisadoes
Copy link
Contributor

Closing

@palisadoes palisadoes closed this as not planned Won't fix, can't repro, duplicate, stale Jan 4, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working dependencies Pull requests that update a dependency file
Projects
None yet
Development

No branches or pull requests

5 participants