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

SyntaxError when running 'pnpm dev' command in the cloned repository. #21

Open
baydisng13 opened this issue Jul 6, 2023 · 6 comments
Open

Comments

@baydisng13
Copy link

When running the 'pnpm dev' command in the cloned repository, the following error occurs:

- error file:///C:/Users/baydis/Desktop/code/next-contentlayer-example/node_modules/.pnpm/@[email protected]_@[email protected]_@[email protected]_@opentelemetry+core@1._vak64uwhuw23bp45xj3whrz3hy/node_modules/@effect-ts/otel/_mjs/Processor/Simple/index.mjs:7
import { ConsoleSpanExporter, SimpleSpanProcessor } from "@opentelemetry/sdk-trace-base";
         ^^^^^^^^^^^^^^^^^^^
SyntaxError: Named export 'ConsoleSpanExporter' not found. The requested module '@opentelemetry/sdk-trace-base' 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 '@opentelemetry/sdk-trace-base';
const { ConsoleSpanExporter, SimpleSpanProcessor } = pkg;

    at ModuleJob._instantiate (node:internal/modules/esm/module_job:124:21)
    at async ModuleJob.run (node:internal/modules/esm/module_job:190:5)
file:///C:/Users/baydis/Desktop/code/next-contentlayer-example/node_modules/.pnpm/@[email protected]_@[email protected]_@[email protected]_@opentelemetry+core@1._vak64uwhuw23bp45xj3whrz3hy/node_modules/@effect-ts/otel/_mjs/Processor/Simple/index.mjs:7
import { ConsoleSpanExporter, SimpleSpanProcessor } from "@opentelemetry/sdk-trace-base";
         ^^^^^^^^^^^^^^^^^^^
SyntaxError: Named export 'ConsoleSpanExporter' not found. The requested module '@opentelemetry/sdk-trace-base' 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 '@opentelemetry/sdk-trace-base';
const { ConsoleSpanExporter, SimpleSpanProcessor } = pkg;

    at ModuleJob._instantiate (node:internal/modules/esm/module_job:124:21)
    at async ModuleJob.run (node:internal/modules/esm/module_job:190:5)

This error is related to the module '@opentelemetry/sdk-trace-base' and its named exports 'ConsoleSpanExporter' and 'SimpleSpanProcessor'. The error suggests that the requested module is a CommonJS module, which may not support importing named exports. Instead, it recommends importing via the default export.

Steps to Reproduce:

  1. Clone the repository using the command: git clone https://github.com/contentlayerdev/next-contentlayer-example.git
  2. Change directory to the cloned repository: cd next-contentlayer-example
  3. Install dependencies using the package manager 'pnpm': pnpm i
  4. Run the development server: pnpm dev

Expected Behavior:
The 'pnpm dev' command should run successfully without any syntax errors.

Actual Behavior:
The 'pnpm dev' command throws a SyntaxError related to the module '@opentelemetry/sdk-trace-base' and its named exports 'ConsoleSpanExporter' and 'SimpleSpanProcessor'. The error suggests importing via the default export instead.

Additional Information:

  • The error message indicates that the issue may be caused by a compatibility problem between the CommonJS module and the import syntax used in the code.
  • It is recommended to modify the import statements for the affected modules according to the suggestions provided in the error message to resolve the issue.
@ParkerRex
Copy link

Ive been fighting this for 3 hours

WHAT IS GOING ON :O

@ParkerRex
Copy link

@baydisng13
Copy link
Author

this is not working for me tho I keep getting the same error on pnpm dev

@Firgrep
Copy link

Firgrep commented Jul 7, 2023

Same error for me too.

@zeabdullah
Copy link

To me, it's not just happening with pnpm, but with npm, too. :/

@mimamch
Copy link

mimamch commented Jul 11, 2023

Same error

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