Error [ERR_REQUIRE_ESM]: require() of ES Module
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 35/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Cần làm rõ
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- javascript, node.js
- Lĩnh vực
- backend
Hướng nghiên cứu
Bắt đầu bằng cách tái hiện lỗi với node index.js, sau đó kiểm tra package.json, cloud/main.js, index.js:36 và lệnh gọi require tại node_modules/parse-server/lib/ParseServer.js:146. So sánh các thiết lập module với hướng dẫn ERR_REQUIRE_ESM được báo cáo và xác minh rằng ví dụ khởi động mà không có lỗi.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Hi Team,
I am facing below error when i run "node index.js"
warn: DeprecationWarning: The Parse Server option 'allowClientClassCreation' default will change to 'false' in a future version.
warn: DeprecationWarning: The Parse Server option 'allowExpiredAuthDataToken' default will change to 'false' in a future version.
warn: DeprecationWarning: The Parse Server option 'encodeParseObjectInCloudFunction' default will change to 'true' in a future version.
Error [ERR_REQUIRE_ESM]: require() of ES Module /home/farhan/parse-server-example/cloud/main.js from /home/farhan/parse-server-example/node_modules/parse-server/lib/ParseServer.js not supported.
main.js is treated as an ES module file as it is a .js file whose nearest parent package.json contains "type": "module" which declares all .js files in that package scope as ES modules.
Instead rename main.js to end in .cjs, change the requiring code to use dynamic import() which is available in all CommonJS modules, or change "type": "module" to "type": "commonjs" in /home/farhan/parse-server-example/package.json to treat all .js files as CommonJS (using .mjs for all ES modules instead).
at ParseServer.start (/home/farhan/parse-server-example/node_modules/parse-server/lib/ParseServer.js:146:13)
at async file:///home/farhan/parse-server-example/index.js:36:3 {
code: 'ERR_REQUIRE_ESM'
}
/home/farhan/parse-server-example/node_modules/parse-server/lib/ParseServer.js:146
require(path.resolve(process.cwd(), cloud));
^
Error [ERR_REQUIRE_ESM]: require() of ES Module /home/farhan/parse-server-example/cloud/main.js from /home/farhan/parse-server-example/node_modules/parse-server/lib/ParseServer.js not supported.
main.js is treated as an ES module file as it is a .js file whose nearest parent package.json contains "type": "module" which declares all .js files in that package scope as ES modules.
Instead rename main.js to end in .cjs, change the requiring code to use dynamic import() which is available in all CommonJS modules, or change "type": "module" to "type": "commonjs" in /home/farhan/parse-server-example/package.json to treat all .js files as CommonJS (using .mjs for all ES modules instead).
at ParseServer.start (/home/farhan/parse-server-example/node_modules/parse-server/lib/ParseServer.js:146:13)
at async file:///home/farhan/parse-server-example/index.js:36:3 {
code: 'ERR_REQUIRE_ESM'
}
- Ngôn ngữ chính
- JavaScript
- Star
- 1.9k
- Fork
- 5.3k
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
- Có Dockerfile hoặc tệp Docker Compose
- Không có mẫu pull request
- Không có hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của parse-community/parse-server-example
-
typo error in README.md fileCó thể đã có người làm @Syed25794 đã nhận 1230 ngày trước. Đang mở
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 65/100
parse-community/parse-server-example#436 · 1 bình luận ·
-
An error with npm start: Error [ERR_UNSUPPORTED_ESM_URL_SCHEME]: Only URLs with a scheme in: file and data are supported by the default ESM loader. On Windows, absolute paths must be valid file:// URLs. Received protocol 'c:'Có thể đã có người làm @rjcodedev đã nhận 1000 ngày trước. Đang mởtype:bug
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 30/100
parse-community/parse-server-example#432 · 17 bình luận ·
-
Failing tests on node 18.xĐang mởtype:bug
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 35/100
parse-community/parse-server-example#431 · 3 bình luận ·
-
type:bug
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 25/100
parse-community/parse-server-example#420 · 1 bình luận ·
-
Quick-start deployment buttons not workingCó thể đã có người làm @gut-puncture đã nhận 148 ngày trước. Đang mởtype:docs
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 35/100
parse-community/parse-server-example#404 · 4 bình luận · 1 reaction ·
Tất cả issue của parse-community/parse-server-example
Issue tương tự
-
Độ khó 2/5 Dưới một giờ Mức phù hợp với người mới 85/100
capricorn86/happy-dom#2474 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 90/100
juice-shop/juice-shop#3662 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 70/100
-
Add unit-test coverage for API URL resolution and device authentication error handlingCó thể đã có người làm @Simranjit8933 đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 90/100
fossasia/eventyay-checkin#170 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
Maintainer thường phản hồi trong vòng 1 ngày