gpt-tokenizer icon indicating copy to clipboard operation
gpt-tokenizer copied to clipboard

vercel/pkg Error with gpt-tokenizer

Open Ranork opened this issue 7 months ago • 0 comments

When we use gpt-tokenizer pkg packageging fails.

The warning in build:

Warning Cannot find module 'gpt-tokenizer/model/gpt-3.5-turbo' from 'D:\****\explorer'  in D:\***\explorer.js
> Warning Cannot include file %1 into executable.
  The file must be distributed with executable as %2.
  %1: node_modules\open\xdg-open
  %2: path-to-executable/xdg-open
> Warning Cannot include file %1 into executable.
  The file must be distributed with executable as %2.
  %1: node_modules\open\xdg-open
  %2: path-to-executable/xdg-open

The error in execute:

Error: Cannot find module 'C:\snapshot\***\dist\main.js'
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
    at Function._resolveFilename (pkg/prelude/bootstrap.js:1951:46)
    at Function.Module._load (node:internal/modules/cjs/loader:778:27)
    at Function.runMain (pkg/prelude/bootstrap.js:1979:12)
    at node:internal/main/run_main_module:17:47 {
  code: 'MODULE_NOT_FOUND',
  requireStack: []
}

The package.json:

{
  "name": "fileservice",
  "version": "1.0.0",
  "description": "File Service",
  "type": "module",
  "main": "src/main.js",
  "scripts": {
    "start": "babel-node src/main.js",
    "convert": "npx babel src -d dist",
    "package": "pkg ./dist/main.js -o dist-public/FileService --public-packages \"*\"",
    "build": "npm run convert && npm run package && ROBOCOPY .\\ .\\dist-public\\ .env"
  },
  "pkg": {
    "outputPath": "dist",
    "options": [
      "experimental-modules"
    ],
    "assets": [
      "node_modules/.prisma/client/*.node",
      "node_modules/axios/dist/node/axios.cjs",
      "node_modules/bcrypt/lib/binding/napi-v3/bcrypt_lib.node"
    ]
  },
  "keywords": [],
  "author": "Akatron Network",
  "license": "ISC",
  "dependencies": {
    "axios": "0.27.2",
    "babel-jest": "^29.6.4",
    "directory-tree": "^3.5.1",
    "dotenv": "^16.3.1",
    "form-data": "^4.0.0"
  },
  "devDependencies": {
    "@babel/cli": "^7.22.10",
    "@babel/core": "^7.22.11",
    "@babel/node": "^7.22.10",
    "@babel/preset-env": "^7.22.14",
    "@babel/register": "^7.22.5",
    "babel-plugin-module-resolver": "^5.0.0",
    "babel-plugin-transform-import-meta": "^2.2.1"
  }
}

Ranork avatar Nov 28 '23 15:11 Ranork