-
Notifications
You must be signed in to change notification settings - Fork 36
Description
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/@effect-ts+otel@0.15.1_@effect-ts+core@0.60.5_@opentelemetry+api@1.4.1_@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/@effect-ts+otel@0.15.1_@effect-ts+core@0.60.5_@opentelemetry+api@1.4.1_@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:
- Clone the repository using the command:
git clone https://github.com/contentlayerdev/next-contentlayer-example.git - Change directory to the cloned repository:
cd next-contentlayer-example - Install dependencies using the package manager 'pnpm':
pnpm i - 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.