当前位置:   article > 正文

tsnode debug_at function.module._resolvefilename.shareddata.mod

at function.module._resolvefilename.shareddata.moduleresolvefilenamehook.ins

一. 下载源码

GitHub - milvus-io/milvus-sdk-node: The Official Mivus node.js sdk(client)

二、初始化

进入根目录:

pnpm install

三、修改DataQuerty.ts 的数据库链接地址为milvus地址

四、ts-node DataQuery.tx 

报错如下:

  1. Error: Cannot find module '@xenova/transformers'
  2. Require stack:
  3. - /data2/vector/milvus/milvus-sdk-node/node_modules/.pnpm/langchain@0.0.200/node_modules/langchain/dist/embeddings/hf_transformers.cjs
  4. - /data2/vector/milvus/milvus-sdk-node/node_modules/.pnpm/langchain@0.0.200/node_modules/langchain/embeddings/hf_transformers.cjs
  5. - /data2/vector/milvus/milvus-sdk-node/examples/milvus/embeddingTest.ts
  6. at Function.Module._resolveFilename (node:internal/modules/cjs/loader:1134:15)
  7. at Function.Module._resolveFilename.sharedData.moduleResolveFilenameHook.installedValue [as _resolveFilename] (/usr/local/lib/node_modules/ts-node/node_modules/@cspotcode/source-map-support/source-map-support.js:811:30)
  8. at Function.Module._load (node:internal/modules/cjs/loader:975:27)
  9. at Module.require (node:internal/modules/cjs/loader:1225:19)
  10. at require (node:internal/modules/helpers:177:18)
  11. at Object.<anonymous> (/data2/vector/milvus/milvus-sdk-node/node_modules/.pnpm/langchain@0.0.200/node_modules/langchain/dist/embeddings/hf_transformers.cjs:4:24)
  12. at Module._compile (node:internal/modules/cjs/loader:1356:14)
  13. at Module._extensions..js (node:internal/modules/cjs/loader:1414:10)
  14. at Object.require.extensions.<computed> [as .js] (/usr/local/lib/node_modules/ts-node/src/index.ts:1608:43)
  15. at Module.load (node:internal/modules/cjs/loader:1197:32) {
  16. code: 'MODULE_NOT_FOUND',
  17. requireStack: [
  18. '/data2/vector/milvus/milvus-sdk-node/node_modules/.pnpm/langchain@0.0.200/node_modules/langchain/dist/embeddings/hf_transformers.cjs',
  19. '/data2/vector/milvus/milvus-sdk-node/node_modules/.pnpm/langchain@0.0.200/node_modules/langchain/embeddings/hf_transformers.cjs',
  20. '/data2/vector/milvus/milvus-sdk-node/examples/milvus/embeddingTest.ts'
  21. ]
  22. }

1. 安装transfromer

pnpm i '@xenova/transformers' -D

  1. base) gw00241401@gw00241401-pc:/data2/vector/milvus/milvus-sdk-node$ pnpm i '@xenova/transformers' -D
  2. Packages: +45 -1
  3. +++++++++++++++++++++++++++++++++++++++++++++-
  4. Progress: resolved 463, reused 462, downloaded 0, added 45, done
  5. devDependencies:
  6. + @xenova/transformers 2.9.0
  7.  WARN  Issues with peer dependencies found
  8. .
  9. └─┬ typedoc 0.24.8
  10. └── ✕ unmet peer typescript@"4.6.x || 4.7.x || 4.8.x || 4.9.x || 5.0.x || 5.1.x": found 5.3.2
  11. Done in 8.4s

2.运行tsnode 报错

  1. (base) gw00241401@gw00241401-pc:/data2/vector/milvus/milvus-sdk-node$ ts-node ./examples/milvus/embeddingTest.ts
  2. /usr/local/lib/node_modules/ts-node/dist/index.js:851
  3. return old(m, filename);
  4. ^
  5. Error [ERR_REQUIRE_ESM]: require() of ES Module /data2/vector/milvus/milvus-sdk-node/node_modules/.pnpm/@xenova+transformers@2.9.0/node_modules/@xenova/transformers/src/transformers.js from /data2/vector/milvus/milvus-sdk-node/node_modules/.pnpm/langchain@0.0.200_@xenova+transformers@2.9.0/node_modules/langchain/dist/embeddings/hf_transformers.cjs not supported.
  6. Instead change the require of transformers.js in /data2/vector/milvus/milvus-sdk-node/node_modules/.pnpm/langchain@0.0.200_@xenova+transformers@2.9.0/node_modules/langchain/dist/embeddings/hf_transformers.cjs to a dynamic import() which is available in all CommonJS modules.
  7. at require.extensions.<computed> [as .js] (/usr/local/lib/node_modules/ts-node/dist/index.js:851:20)
  8. at Object.<anonymous> (/data2/vector/milvus/milvus-sdk-node/node_modules/.pnpm/langchain@0.0.200_@xenova+transformers@2.9.0/node_modules/langchain/dist/embeddings/hf_transformers.cjs:4:24)
  9. at require.extensions.<computed> [as .js] (/usr/local/lib/node_modules/ts-node/dist/index.js:851:20)
  10. at Object.<anonymous> (/data2/vector/milvus/milvus-sdk-node/node_modules/.pnpm/langchain@0.0.200_@xenova+transformers@2.9.0/node_modules/langchain/embeddings/hf_transformers.cjs:1:18)
  11. at require.extensions.<computed> [as .js] (/usr/local/lib/node_modules/ts-node/dist/index.js:851:20)
  12. at Object.<anonymous> (/data2/vector/milvus/milvus-sdk-node/examples/milvus/embeddingTest.ts:3:27)
  13. at m._compile (/usr/local/lib/node_modules/ts-node/dist/index.js:857:29)
  14. at require.extensions.<computed> [as .ts] (/usr/local/lib/node_modules/ts-node/dist/index.js:859:16)
  15. at phase4 (/usr/local/lib/node_modules/ts-node/dist/bin.js:466:20)
  16. at bootstrap (/usr/local/lib/node_modules/ts-node/dist/bin.js:54:12)
  17. at main (/usr/local/lib/node_modules/ts-node/dist/bin.js:33:12)
  18. at Object.<anonymous> (/usr/local/lib/node_modules/ts-node/dist/bin.js:579:5) {
  19. code: 'ERR_REQUIRE_ESM'

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/你好赵伟/article/detail/129758?site
推荐阅读
相关标签
  

闽ICP备14008679号