Skip to content

@serialport/list, @serialport/terminal requires 'package.json' to run #2972

Description

@serg3295

SerialPort Version

13.0.0

Node Version

v20.18.1

Electron Version

No response

Platform

Linux Lenovo 6.8.0-51-generic #52-Ubuntu SMP PREEMPT_DYNAMIC Thu Dec 5 13:09:44 UTC 2024 x86_64 x86_64 x86_64 GNU/Linux

Architecture

x64

Hardware or chipset of serialport

esp32, esp8266

What steps will reproduce the bug?

npx @serialport/terminal
npx @serialport/list

What happens?

Crash log
❯ npx @serialport/terminal
node:fs:448
  return binding.readFileUtf8(path, stringToFlags(options.flag));
                 ^

Error: ENOENT: no such file or directory, open '../package.json'
  at readFileSync (node:fs:448:20)
  at Object.<anonymous> (/home/serg/Projects/js/begin/node_modules/.pnpm/@serialport+terminal@13.0.0/node_modules/@serialport/terminal/dist/index.js:13:59)
  at Module._compile (node:internal/modules/cjs/loader:1469:14)
  at Module._extensions..js (node:internal/modules/cjs/loader:1548:10)
  at Module.load (node:internal/modules/cjs/loader:1288:32)
  at Module._load (node:internal/modules/cjs/loader:1104:12)
  at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:173:12)
  at node:internal/main/run_main_module:28:49 {
errno: -2,
code: 'ENOENT',
syscall: 'open',
path: '../package.json'
}

Node.js v20.18.1

❯ npx @serialport/list
node:fs:448
  return binding.readFileUtf8(path, stringToFlags(options.flag));
                 ^

Error: ENOENT: no such file or directory, open '../package.json'
  at readFileSync (node:fs:448:20)
  at Object.<anonymous> (/home/serg/Projects/js/begin/node_modules/.pnpm/@serialport+list@13.0.0/node_modules/@serialport/list/dist/index.js:7:59)
  at Module._compile (node:internal/modules/cjs/loader:1469:14)
  at Module._extensions..js (node:internal/modules/cjs/loader:1548:10)
  at Module.load (node:internal/modules/cjs/loader:1288:32)
  at Module._load (node:internal/modules/cjs/loader:1104:12)
  at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:173:12)
  at node:internal/main/run_main_module:28:49 {
errno: -2,
code: 'ENOENT',
syscall: 'open',
path: '../package.json'
}

❯ npx @serialport/repl
No arduinos found. You must specify a port to load.

For example:
      serialport-repl COM3
      serialport-repl /dev/tty.my-serialport

Node.js v20.18.1

What should have happened?

The @serialport/list, @serialport/terminal should run without additional 'package.json'

Additional information

I added ../package.json:

{
  "version": "0.1.0",
  "description": "testing"
}

the @serialport/list, @serialport/terminal started working.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions