question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

TypeError: Cannot read property 'port' of undefined. After update to version 1.6.11

See original GitHub issue

Describe the bug Error after update to version 1.6.11

/usr/local/lib/node_modules/green-tunnel/bin/gt.js:29
		default: config.port,
		                ^

TypeError: Cannot read property 'port' of undefined
    at Object.<anonymous> (/usr/local/lib/node_modules/green-tunnel/bin/gt.js:29:19)
    at Module._compile (internal/modules/cjs/loader.js:776:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10)
    at Module.load (internal/modules/cjs/loader.js:653:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
    at Function.Module._load (internal/modules/cjs/loader.js:585:3)
    at Function.Module.runMain (internal/modules/cjs/loader.js:829:12)
    at startup (internal/bootstrap/node.js:283:19)
    at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3)

To Reproduce Steps to reproduce the behavior:

  1. From green-tunnel 1.4.0 in MacOS Catalina
  2. run npm i -g green-tunnel to upgrade version to 1.6.11
  3. update complete, now run green-tunnel
  4. Error occurs like above

Expected behavior Running properly as usual

Screenshots If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: MacOS Catalina 10.15.2

Additional context Add any other context about the problem here.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
crierrcommented, Jan 4, 2020

I had same problem and it was because of a cache file esm module made. cache file looked like below, which exports old getConfig instead of config

.../lib/node_modules/green-tunnel/node_modules/.cache/esm/e5d042d934e7ddee.js:1:
let net,setProxy,unsetProxy,handleRequest,DNSOverTLS,DNSOverHTTPS,getConfig,getLogger;

Cleaning up npm cache would resolve this issue

npm cache clean -f

or if you’re not using node 13+, installing newer version would have same effect (I had to install node 13+ to use 1.6.11 because of export keyword)

0reactions
dhamanutdcommented, Jan 14, 2020

following @pcr910303 suggestion. I tried to fix itself directly to the /usr/local/bin/gt file.

just changed some lines

const {Proxy, config, getLogger} = require('../src/index.cjs');

to

const {Proxy, getConfig, getLogger} = require('../src/index.cjs');
const config = getConfig();

want to create the pull request for this, but i see the latest code in master branch in index.js file has already named properly for the config variable.

@SadeghHayeri

Read more comments on GitHub >

github_iconTop Results From Across the Web

TypeError: Cannot read property 'port' of undefined · Issue #672
I have a node.js app which runs normally on my local machine and in my personal folder on Entarch as my personal account...
Read more >
TypeError: Cannot read property 'PORT' of undefined at Object ...
process.environment doesn't exist, so the expression is undefined . Then, you try to access PORT of the undefined value, causing the error ...
Read more >
Cannot Read Property of Undefined in JavaScript - Rollbar
TypeError : Cannot read property of undefined occurs when a property is read or a function is called on an undefined variable.
Read more >
cannot read properties of undefined (reading 'data') axios
This error occurs when the Axios library is unable to find the data it is looking for. This can be caused by a...
Read more >
Help test 2.3.1 RC - core - Meteor forums
First we have update to Node 14.17.2 of the July security release. ... TypeError: Cannot read property '_handleConnect' of undefined ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found