Build Issue in Version 1.9.0
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 35/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- javascript, node.js
- Lĩnh vực
- build-system, testing-qa
Hướng nghiên cứu
Start with package.json and reproduce the reported npm install, npm update, npm run build, and npm test failures on version 1.9.0. Then trace the alias and dependency handling from src/CmapProcessor.js and inspect test/glyph_mapping.js, especially the legacy-encoding case. Done means the 1.9.x build and test suite complete successfully, including legacy cmap handling.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
In my environment, when I check out version 1.9.0 and run npm install, I encounter the following error.
npm error code 1
npm error path /Users/omochi/temp/fontkit/node_modules/lmdb
npm error command failed
npm error command sh -c node-gyp-build
npm error CXX(target) Release/obj.target/lmdb/src/lmdb-js.o
npm error gyp info it worked if it ends with ok
npm error gyp info using [email protected]
npm error gyp info using [email protected] | darwin | arm64
npm error gyp info find Python using Python version 3.9.6 found at "/Applications/Xcode16.2-beta.app/Contents/Developer/usr/bin/python3"
npm error gyp info spawn /Applications/Xcode16.2-beta.app/Contents/Developer/usr/bin/python3
npm error gyp info spawn args [
npm error gyp info spawn args '/opt/homebrew/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py',
npm error gyp info spawn args 'binding.gyp',
npm error gyp info spawn args '-f',
npm error gyp info spawn args 'make',
npm error gyp info spawn args '-I',
npm error gyp info spawn args '/Users/omochi/temp/fontkit/node_modules/lmdb/build/config.gypi',
npm error gyp info spawn args '-I',
npm error gyp info spawn args '/opt/homebrew/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
npm error gyp info spawn args '-I',
npm error gyp info spawn args '/Users/omochi/Library/Caches/node-gyp/22.5.1/include/node/common.gypi',
npm error gyp info spawn args '-Dlibrary=shared_library',
npm error gyp info spawn args '-Dvisibility=default',
npm error gyp info spawn args '-Dnode_root_dir=/Users/omochi/Library/Caches/node-gyp/22.5.1',
npm error gyp info spawn args '-Dnode_gyp_dir=/opt/homebrew/lib/node_modules/npm/node_modules/node-gyp',
npm error gyp info spawn args '-Dnode_lib_file=/Users/omochi/Library/Caches/node-gyp/22.5.1/<(target_arch)/node.lib',
npm error gyp info spawn args '-Dmodule_root_dir=/Users/omochi/temp/fontkit/node_modules/lmdb',
npm error gyp info spawn args '-Dnode_engine=v8',
npm error gyp info spawn args '--depth=.',
npm error gyp info spawn args '--no-parallel',
npm error gyp info spawn args '--generator-output',
npm error gyp info spawn args 'build',
npm error gyp info spawn args '-Goutput_dir=.'
npm error gyp info spawn args ]
npm error gyp info spawn make
npm error gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
npm error In file included from ../src/lmdb-js.cpp:1:
npm error In file included from ../src/lmdb-js.h:32:
npm error In file included from ../../nan/nan.h:178:
npm error ../../nan/nan_callbacks.h:55:23: error: no member named 'AccessorSignature' in namespace 'v8'
npm error 55 | typedef v8::Local<v8::AccessorSignature> Sig;
npm error | ~~~~^
npm error In file included from ../src/lmdb-js.cpp:1:
npm error In file included from ../src/lmdb-js.h:32:
npm error ../../nan/nan.h:2544:8: error: no matching member function for call to 'SetAccessor'
npm error 2544 | tpl->SetAccessor(
npm error | ~~~~~^~~~~~~~~~~
npm error /Users/omochi/Library/Caches/node-gyp/22.5.1/include/node/v8-template.h:1055:8: note: candidate function not viable: no known conversion from 'v8::AccessControl' to 'PropertyAttribute' for 5th argument
npm error 1055 | void SetAccessor(
npm error | ^
npm error 1056 | Local<Name> name, AccessorNameGetterCallback getter,
npm error 1057 | AccessorNameSetterCallback setter = nullptr,
npm error 1058 | Local<Value> data = Local<Value>(), PropertyAttribute attribute = None,
npm error | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
npm error /Users/omochi/Library/Caches/node-gyp/22.5.1/include/node/v8-template.h:1049:8: note: candidate function not viable: no known conversion from 'imp::NativeGetter' (aka 'void (*)(v8::Local<v8::Name>, const v8::PropertyCallbackInfo<v8::Value> &)') to 'AccessorGetterCallback' (aka 'void (*)(Local<String>, const PropertyCallbackInfo<Value> &)') for 2nd argument
npm error 1049 | void SetAccessor(
npm error | ^
npm error 1050 | Local<String> name, AccessorGetterCallback getter,
npm error | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
npm error In file included from ../src/lmdb-js.cpp:1:
npm error In file included from ../src/lmdb-js.h:29:
npm error In file included from /Users/omochi/Library/Caches/node-gyp/22.5.1/include/node/v8.h:24:
npm error In file included from /Users/omochi/Library/Caches/node-gyp/22.5.1/include/node/v8-array-buffer.h:12:
npm error /Users/omochi/Library/Caches/node-gyp/22.5.1/include/node/v8-local-handle.h:269:19: error: static assertion failed due to requirement 'std::is_base_of<v8::Value, v8::Data>::value': type check
npm error 269 | static_assert(std::is_base_of<T, S>::value, "type check");
npm error | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
npm error ../../nan/nan_callbacks_12_inl.h:175:20: note: in instantiation of function template specialization 'v8::Local<v8::Value>::Local<v8::Data>' requested here
npm error 175 | cbinfo(info, obj->GetInternalField(kDataIndex));
npm error | ^
npm error 3 errors generated.
npm error make: *** [Release/obj.target/lmdb/src/lmdb-js.o] Error 1
npm error gyp ERR! build error
npm error gyp ERR! stack Error: `make` failed with exit code: 2
npm error gyp ERR! stack at ChildProcess.<anonymous> (/opt/homebrew/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:209:23)
npm error gyp ERR! System Darwin 24.1.0
npm error gyp ERR! command "/opt/homebrew/Cellar/node/22.5.1/bin/node" "/opt/homebrew/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
npm error gyp ERR! cwd /Users/omochi/temp/fontkit/node_modules/lmdb
npm error gyp ERR! node -v v22.5.1
npm error gyp ERR! node-gyp -v v10.1.0
npm error gyp ERR! not ok
npm error A complete log of this run can be found in: /Users/omochi/.npm/_logs/2024-10-25T00_59_09_454Z-debug-0.log
This issue can be resolved simply by running npm update. However, a new error appears afterward.
> parcel build
(node:7396) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
🚨 Build failed.
@parcel/core: Failed to resolve '@swc/helpers/cjs/_define_property.cjs' from './node_modules/@parcel/transformer-js/lib/JSTransformer.js'
/Users/omochi/temp/fontkit/src/WOFFFont.js:1:1
> 1 | import TTFFont from './TTFFont';
> | ^
2 | import WOFFDirectory from './tables/WOFFDirectory';
3 | import tables from './tables';
@parcel/resolver-default: External dependency "@swc/helpers" does not satisfy required semver range "^0.5.0".
/Users/omochi/temp/fontkit/package.json:52:21
51 | "dependencies": {
> 52 | "@swc/helpers": "^0.3.13",
> | ^^^^^^^^^ Found this conflicting requirement.
53 | "brotli": "^1.3.2",
54 | "clone": "^2.1.2",
💡 Update the dependency on "@swc/helpers" to satisfy "^0.5.0".
ERROR: "build" exited with 1.
npm error code 1
npm error path /Users/omochi/temp/fontkit
npm error command failed
npm error command sh -c run-s clean trie:** build
npm error A complete log of this run can be found in: /Users/omochi/.npm/_logs/2024-10-25T01_05_26_588Z-debug-0.log
This issue can be resolved by updating @swc/helpers from ^0.3.13 to ^0.5.13. However, a new error appears afterward.
> parcel build
(node:9777) [DEP0040] DeprecationWarning: The `punycode` module is deprecated. Please use a userland alternative instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
🚨 Build failed.
@parcel/core: Failed to resolve '../iconv-lite.cjs' from './src/CmapProcessor.js'
/Users/omochi/temp/fontkit/src/CmapProcessor.js:5:19
4 | import { range } from './utils';
> 5 | import iconv from '../iconv-lite.cjs';
> | ^^^^^^^^^^^^^^^^^^^
6 |
7 | export default class CmapProcessor {
@parcel/resolver-default: External dependency ".." is not declared in package.json.
/Users/omochi/temp/fontkit/package.json:51:3
50 | },
> 51 | "dependencies": {
> | ^^^^^^^^^^^^^^
52 | "@swc/helpers": "^0.5.13",
53 | "brotli": "^1.3.2",
💡 Add ".." as a dependency.
ERROR: "build" exited with 1.
This issue can be resolved by removing the following alias setting in package.json:
"alias": {
"./iconv-lite.cjs": "clone"
}
What is the intent behind aliasing ./iconv-lite.cjs to clone in this setting?
The clone module clearly cannot be a substitute for iconv-lite.
With the above changes, both npm install and npm update succeed.
However, npm test fails with the following error.
540 passing (447ms)
7 pending
1 failing
1) character to glyph mapping
basic cmap handling
should support legacy encodings when no unicode cmap is found:
TypeError: (0 , $parcel$interopDefault(...)).encodingExists is not a function
at new $5d24cfe1a4cd83bb$export$2e2bcd8739ae039 (file:///Users/omochi/temp/fontkit/dist/module.mjs:5421:87)
at get _cmapProcessor (file:///Users/omochi/temp/fontkit/dist/module.mjs:12527:16)
at descriptor.get (file:///Users/omochi/temp/fontkit/dist/module.mjs:85:29)
at $7de97f725b51e05a$export$2e2bcd8739ae039.glyphForCodePoint (file:///Users/omochi/temp/fontkit/dist/module.mjs:12550:35)
at $7de97f725b51e05a$export$2e2bcd8739ae039.glyphsForString (file:///Users/omochi/temp/fontkit/dist/module.mjs:12590:30)
at Context.<anonymous> (file:///Users/omochi/temp/fontkit/test/glyph_mapping.js:40:25)
at process.processImmediate (node:internal/timers:483:21)
Upon investigating the error, it seems that an exception occurs in iconv-lite.cjs when calling require('iconv-lite'), resulting in an empty object being exported.
In CmapProcessor.js, the code checks whether iconv is truthy, but since the empty object returned upon failure is truthy, the check fails.
While this logic should also be fixed, the test case states should support legacy encodings when no unicode cmap is found, so the inability to load iconv-lite is a more significant issue.
I believe this is caused by the configuration when bundling with Parcel, but since I am not familiar with it, I couldn’t determine the solution.
As mentioned in #350, I am using fontkit as a dependency in pdfkit, so I would like to stabilize and maintain the build and tests for the 1.9.x series. Could you advise me on how to resolve this issue?
- Ngôn ngữ chính
- JavaScript
- Star
- 1.7k
- Fork
- 254
- Merge trung bình
- 1 ngày 13 giờ
- Pull request đã merge (30 ngày)
- 22
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
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 foliojs/fontkit
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 88/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 25/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Vertical phantom points have the wrong signCó thể đã có người làm @lehni đã nhận 12 ngày trước. Đang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 25/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 20/100
foliojs/fontkit#382 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 15/100
foliojs/fontkit#368 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của foliojs/fontkit
Issue tương tự
-
stringify escapes leading digits in pseudo-class arguments (:nth-child(1) becomes :nth-child(\31 ))Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 83/100
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 82/100
digitalbazaar/forge#1170 ·
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 76/100
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 68/100
getgrav/grav-plugin-form#664 ·
-
bug web-ui
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 67/100
jenkinsci/jenkins#27705 · 3 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày