Skip to content

Support Node.js v19 #14

Closed
Closed

Description

@VectorZhao

I want to use docker to build this project, but there is no .env file. Did you forget to add it to the project?

Activity

  1. VectorZhao commented on Feb 21, 2023

    @VectorZhao
    Author

    I created a node container and when I run command pnpm install I got the following error:

    root@chatgpt:/home/chatgpt-tg-bot# pnpm install
    Lockfile is up to date, resolution step is skipped
    Packages: +470
    ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    Packages are cloned from the content-addressable store to the virtual store.
      Content-addressable store is at: /home/chatgpt-tg-bot/.pnpm-store/v3
      Virtual store is at:             node_modules/.pnpm
    Downloading registry.npmmirror.com/typescript/4.9.5: 11.6 MB/11.6 MB, done
    Progress: resolved 470, reused 0, downloaded 470, added 470, done
    node_modules/.pnpm/registry.npmmirror.com+puppeteer@19.7.1_typescript@4.9.5/node_modules/puppeteer: Running postinstall script, failed in 3.7s
    .../node_modules/puppeteer postinstall$ node install.js
    │ The chromium binary is not available for arm64.
    │ If you are on Ubuntu, you can install with: 
    │  sudo apt install chromium
    │  sudo apt install chromium-browser
    │ ERROR: Failed to set up Chromium r1095492! Set "PUPPETEER_SKIP_DOWNLOAD" env variable to skip download.
    │ Error
    │     at handleArm64 (/home/chatgpt-tg-bot/node_modules/.pnpm/registry.npmmirror.com+puppeteer-core@19.7.1_typescript@4.9.5/node_modul
    │     at BrowserFetcher.download (/home/chatgpt-tg-bot/node_modules/.pnpm/registry.npmmirror.com+puppeteer-core@19.7.1_typescript@4.9.
    │     at async downloadBrowser (/home/chatgpt-tg-bot/node_modules/.pnpm/registry.npmmirror.com+puppeteer@19.7.1_typescript@4.9.5/node_
    └─ Failed in 3.7s at /home/chatgpt-tg-bot/node_modules/.pnpm/registry.npmmirror.com+puppeteer@19.7.1_typescript@4.9.5/node_modules/puppeteer
     ELIFECYCLE  Command failed with exit code 1.
    

    The api.type in local.json file has been set to unofficial.

  2. VectorZhao commented on Feb 21, 2023

    @VectorZhao
    Author
    root@chatgpt:/home/chatgpt-tg-bot# pnpm install
    Lockfile is up to date, resolution step is skipped
    Packages: +470
    ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
    Packages are cloned from the content-addressable store to the virtual store.
      Content-addressable store is at: /home/chatgpt-tg-bot/.pnpm-store/v3
      Virtual store is at:             node_modules/.pnpm
    Downloading registry.npmmirror.com/typescript/4.9.5: 11.6 MB/11.6 MB, done
    Progress: resolved 470, reused 0, downloaded 470, added 470, done
    node_modules/.pnpm/registry.npmmirror.com+puppeteer@19.7.1_typescript@4.9.5/node_modules/puppeteer: Running postinstall script, done in 8.8s
    
    dependencies:
    + chatgpt 4.5.1
    + chatgpt-v3 <- chatgpt 3.5.1
    + config 3.3.9
    + dotenv 16.0.3
    + lodash 4.17.21
    + node-telegram-bot-api 0.60.0
    + puppeteer 19.7.1
    
    devDependencies:
    + @types/config 3.3.0
    + @types/lodash 4.14.191
    + @types/node 18.14.0
    + @types/node-telegram-bot-api 0.57.7
    + @typescript-eslint/eslint-plugin 5.52.0
    + @typescript-eslint/parser 5.52.0
    + eslint 8.34.0
    + eslint-config-prettier 8.6.0
    + husky 8.0.3
    + lint-staged 13.1.2
    + prettier 2.8.4
    + tsc-watch 6.0.0
    + typescript 4.9.5
    
    > chatgpt-telegram-bot@2.1.0 prepare /home/chatgpt-tg-bot
    > husky install
    
    husky - Git hooks installed
    
    Done in 3m 57.1s
    root@chatgpt:/home/chatgpt-tg-bot# pnpm build && pnpm start
    
    > chatgpt-telegram-bot@2.1.0 build /home/chatgpt-tg-bot
    > tsc --build
    
    
    > chatgpt-telegram-bot@2.1.0 start /home/chatgpt-tg-bot
    > node --experimental-specifier-resolution=node dist/index.js
    
    node:internal/errors:490
        ErrorCaptureStackTrace(err);
        ^
    
    Error [ERR_MODULE_NOT_FOUND]: Cannot find module '/home/chatgpt-tg-bot/dist/api' imported from /home/chatgpt-tg-bot/dist/index.js
        at new NodeError (node:internal/errors:399:5)
        at finalizeResolution (node:internal/modules/esm/resolve:231:11)
        at moduleResolve (node:internal/modules/esm/resolve:850:10)
        at defaultResolve (node:internal/modules/esm/resolve:1058:11)
        at nextResolve (node:internal/modules/esm/loader:163:28)
        at ESMLoader.resolve (node:internal/modules/esm/loader:835:30)
        at ESMLoader.getModuleJob (node:internal/modules/esm/loader:416:18)
        at ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:76:40)
        at link (node:internal/modules/esm/module_job:75:36) {
      code: 'ERR_MODULE_NOT_FOUND'
    }
    
    Node.js v19.6.1
     ELIFECYCLE  Command failed with exit code 1.
    
    
  3. RainEggplant commented on Feb 21, 2023

    @RainEggplant
    Owner

    I created a node container and when I run command pnpm install I got the following error:

    root@chatgpt:/home/chatgpt-tg-bot# pnpm install
    [...]
    │ The chromium binary is not available for arm64.
    [...]
    │ ERROR: Failed to set up Chromium r1095492! Set "PUPPETEER_SKIP_DOWNLOAD" env variable to skip download.
    [...]
    

    As the error message indicates, puppeteer did not find a chromium browser binary for the arm64 platform. You can set "PUPPETEER_SKIP_DOWNLOAD" environmental variable to skip downloading the browser.

  4. VectorZhao commented on Feb 21, 2023

    @VectorZhao
    Author

    I created a node container and when I run command pnpm install I got the following error:

    root@chatgpt:/home/chatgpt-tg-bot# pnpm install
    [...]
    │ The chromium binary is not available for arm64.
    [...]
    │ ERROR: Failed to set up Chromium r1095492! Set "PUPPETEER_SKIP_DOWNLOAD" env variable to skip download.
    [...]
    

    As the error message indicates, puppeteer did not find a chromium browser binary for the arm64 platform. You can set "PUPPETEER_SKIP_DOWNLOAD" environmental variable to skip downloading the browser.

    yeah, I have done. But Error [ERR_MODULE_NOT_FOUND] as I mentioned above stopped me.

  5. RainEggplant commented on Feb 21, 2023

    @RainEggplant
    Owner
    [...]
    Error [ERR_MODULE_NOT_FOUND]: Cannot find module '/home/chatgpt-tg-bot/dist/api' imported from /home/chatgpt-tg-bot/dist/index.js
    [...]
    Node.js v19.6.1
    

    Node.js v19 has removed the --experimental-specifier-resolution flag (nodejs/node#44859). I'll use a custom loader to achieve a similar function.

  6. changed the title [-]docker compose up-------.env: no such file or directory[/-] [+]Support Node.js v19[/+] on Feb 21, 2023
  7. RainEggplant commented on Feb 21, 2023

    @RainEggplant
    Owner

    Fixed by e35075a

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions