Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

TypeError: Cannot read properties of undefined (reading 'log') #43

Open
tyilo opened this issue Feb 7, 2023 · 0 comments
Open

TypeError: Cannot read properties of undefined (reading 'log') #43

tyilo opened this issue Feb 7, 2023 · 0 comments

Comments

@tyilo
Copy link

tyilo commented Feb 7, 2023

When using version 9 and calling serve with just a callback to use the default path, I get the following error:

/home/tyilo/tmp/node-ipc-test/node_modules/@achrinza/node-ipc/services/IPC.js:111
        this.log(
             ^

TypeError: Cannot read properties of undefined (reading 'log')
    at serve (/home/tyilo/tmp/node-ipc-test/node_modules/@achrinza/node-ipc/services/IPC.js:111:14)
    at Object.<anonymous> (/home/tyilo/tmp/node-ipc-test/index.js:4:1)
    at Module._compile (node:internal/modules/cjs/loader:1246:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1300:10)
    at Module.load (node:internal/modules/cjs/loader:1103:32)
    at Module._load (node:internal/modules/cjs/loader:942:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:83:12)
    at node:internal/main/run_main_module:23:47

Node.js v19.6.0

Steps to reproduce:

$ mkdir node-ipc-test
$ cd node-ipc-test
$ npm init
...
$ npm add @achrinza/node-ipc@9
$ cat > index.js
const ipc = require("@achrinza/node-ipc");
const {serve} = ipc;

serve(() => {
  console.log("Serving");
});
^D
$ node index.js
/home/tyilo/tmp/node-ipc-test/node_modules/@achrinza/node-ipc/services/IPC.js:111
        this.log(
             ^

TypeError: Cannot read properties of undefined (reading 'log')
    at serve (/home/tyilo/tmp/node-ipc-test/node_modules/@achrinza/node-ipc/services/IPC.js:111:14)
    at Object.<anonymous> (/home/tyilo/tmp/node-ipc-test/index.js:4:1)
    at Module._compile (node:internal/modules/cjs/loader:1246:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1300:10)
    at Module.load (node:internal/modules/cjs/loader:1103:32)
    at Module._load (node:internal/modules/cjs/loader:942:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:83:12)
    at node:internal/main/run_main_module:23:47

Node.js v19.6.0
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant