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.

"Node.js application" launcher doesn't expand launch variables (eg `${workspace_loc:/myProject/test.js}`)

See original GitHub issue

Given a Generic Eclipse project my.project containing a file hello.js:

const http = require('http');

const hostname = '127.0.0.1';
const port = 3000;

const server = http.createServer((req, res) => {
  res.statusCode = 200;
  res.setHeader('Content-Type', 'text/plain');
  res.end('Hello World');
});

server.listen(port, hostname, () => {
  console.log(`Server running at http://${hostname}:${port}/`);
});

From Node.js getting started guide

The workspace looks like this:

Eclipse Workspace with an open file 'hello.js'

I would like to start this using a “Node.js Application” launcher, but I am not able to configure it.

Node.js application launcher

I always have this error Not allowed to read file., no matter the value I put in Program.

  • node hello.js (with the Working directory set to ${workspace_loc:/my.project/})
  • node ${workspace_loc:/my.project/hello.js}
  • ${workspace_loc:/my.project/hello.js}
  • ${workspaceFolder}/my.project/hello.js

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:6 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
mickaelistriacommented, Mar 25, 2022

Yes, the root issue is missing variable expansion. Having relative path to working directory would be good as well.

0reactions
mickaelistriacommented, Mar 30, 2022

I merged #807 that should fix that. However, the UI to suggest Variables in launch config is still missing; it’s tracked in #808 . I’m closing this one so you can leverage the fix in upcoming snapshot build. Please reopen with details if it’s not resolved.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How To Launch Child Processes in Node.js - DigitalOcean
Back in your terminal, run your application with the node command: node listFiles.js. Your terminal will display the following output: Output.
Read more >
How do I add environment variables to launch.json in VSCode
I'm successfully passing them using the env property in launch.json : { "version": "0.2.0", "configurations": [ { "type": "pwa-node", ...
Read more >
Process | Node.js v19.3.0 Documentation
The 'beforeExit' event is emitted when Node.js empties its event loop and has no additional work to schedule. Normally, the Node.js process will...
Read more >
Debugging and profiling Node.js applications - IBM Developer
The command to run Node debugging client is: node inspect node_module . To start debugging the Shopping List application, open a terminal window ......
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