PdfMake | Error: ENOENT: no such file or directory, open './build/vfs_fonts.js'
PdfMake | Error: ENOENT: no such file or directory, open './build/vfs_fonts.js'
我正在使用 PDFMake 库并尝试在其输出中使用自定义字体。
这种字体是为波斯语制作的。
我按照下面网页上描述的步骤操作
custom-fonts-client-side/vfs
我在执行node build-vfs.js "./examples/fonts"
命令时遇到如下错误:
Internal/modules/cjs/loader.js:888
throw err;
^
Error: Cannot find module 'D:\ProgrammingWorld\Github_Library\Cyeng\NewProject\onGit\NewProject\build-vfs.js'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:885:15)
at Function.Module._load (internal/modules/cjs/loader.js:730:27)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12)
at internal/main/run_main_module.js:17:47 {
code: 'MODULE_NOT_FOUND',
requireStack: []
}
所以我决定把命令改成这样写:
node node_modules/pdfmake/build-vfs.js "node_modules\pdfmake\examples\fonts"
但不幸的是,我遇到了一个新错误:
Source path: node_modules\pdfmake\examples\fonts
FILE: Shabnam-Bold.ttf
FILE: Shabnam-Light.ttf
FILE: Shabnam-Medium.ttf
FILE: Shabnam-Thin.ttf
FILE: Shabnam.ttf
internal/fs/utils.js:312
throw err;
^
Error: ENOENT: no such file or directory, open './build/vfs_fonts.js'
at Object.openSync (fs.js:498:3)
at Object.writeFileSync (fs.js:1524:35)
at Object.<anonymous> (D:\ProgrammingWorld\Github_Library\Cyeng\NewProject\onGit\NewProject\node_modules\pdfmake\build-vfs.js:41:4)
at Module._compile (internal/modules/cjs/loader.js:1068:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1097:10)
at Module.load (internal/modules/cjs/loader.js:933:32)
at Function.Module._load (internal/modules/cjs/loader.js:774:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12)
at internal/main/run_main_module.js:17:47 {
errno: -4058,
syscall: 'open',
code: 'ENOENT',
path: './build/vfs_fonts.js'
}
转到 node_modules/pdfmake/
目录和 运行 node build-vfs.js "./examples/fonts"
我正在使用 PDFMake 库并尝试在其输出中使用自定义字体。 这种字体是为波斯语制作的。 我按照下面网页上描述的步骤操作 custom-fonts-client-side/vfs
我在执行node build-vfs.js "./examples/fonts"
命令时遇到如下错误:
Internal/modules/cjs/loader.js:888
throw err;
^
Error: Cannot find module 'D:\ProgrammingWorld\Github_Library\Cyeng\NewProject\onGit\NewProject\build-vfs.js'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:885:15)
at Function.Module._load (internal/modules/cjs/loader.js:730:27)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12)
at internal/main/run_main_module.js:17:47 {
code: 'MODULE_NOT_FOUND',
requireStack: []
}
所以我决定把命令改成这样写:
node node_modules/pdfmake/build-vfs.js "node_modules\pdfmake\examples\fonts"
但不幸的是,我遇到了一个新错误:
Source path: node_modules\pdfmake\examples\fonts
FILE: Shabnam-Bold.ttf
FILE: Shabnam-Light.ttf
FILE: Shabnam-Medium.ttf
FILE: Shabnam-Thin.ttf
FILE: Shabnam.ttf
internal/fs/utils.js:312
throw err;
^
Error: ENOENT: no such file or directory, open './build/vfs_fonts.js'
at Object.openSync (fs.js:498:3)
at Object.writeFileSync (fs.js:1524:35)
at Object.<anonymous> (D:\ProgrammingWorld\Github_Library\Cyeng\NewProject\onGit\NewProject\node_modules\pdfmake\build-vfs.js:41:4)
at Module._compile (internal/modules/cjs/loader.js:1068:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1097:10)
at Module.load (internal/modules/cjs/loader.js:933:32)
at Function.Module._load (internal/modules/cjs/loader.js:774:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12)
at internal/main/run_main_module.js:17:47 {
errno: -4058,
syscall: 'open',
code: 'ENOENT',
path: './build/vfs_fonts.js'
}
转到 node_modules/pdfmake/
目录和 运行 node build-vfs.js "./examples/fonts"