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

module.parent not null when run from npm-register.cmd #40

Closed
cdibbs opened this issue Sep 12, 2016 · 2 comments
Closed

module.parent not null when run from npm-register.cmd #40

cdibbs opened this issue Sep 12, 2016 · 2 comments
Labels

Comments

@cdibbs
Copy link

cdibbs commented Sep 12, 2016

The server will not start under windows after global installation. Poking around, it's due to module.parent:

if (!module.parent) {
  app.listen(app.port, function () {
    console.error(`${app.name} listening on port ${app.port} [${app.env}]`)
  })
}

When you install under windows, you get a npm-register.cmd which then runs npm-register\bin\npm-register, which becomes the parent. I was able to get it working by skipping all that and running node path/to/start.js start. That works for me, for now.

Here's a dump of module.parent, in case its useful:

Module {
  id: '.',
  exports: {},
  parent: null,
  filename: 'C:\\Program Files\\nodejs\\node_modules\\npm-register\\bin\\npm-reg
ister',
  loaded: false,
  children:
   [ Module {
       id: 'C:\\Program Files\\nodejs\\node_modules\\npm-register\\node_modules\
\yargs\\index.js',
       exports: [Object],
       parent: [Circular],
       filename: 'C:\\Program Files\\nodejs\\node_modules\\npm-register\\node_mo
dules\\yargs\\index.js',
       loaded: true,
       children: [Object],
       paths: [Object] },
     Module {
       id: 'C:\\Program Files\\nodejs\\node_modules\\npm-register\\server.js',
       exports: [Object],
       parent: [Circular],
       filename: 'C:\\Program Files\\nodejs\\node_modules\\npm-register\\server.
js',
       loaded: false,
       children: [Object],
       paths: [Object] } ],
  paths:
   [ 'C:\\Program Files\\nodejs\\node_modules\\npm-register\\bin\\node_modules',

     'C:\\Program Files\\nodejs\\node_modules\\npm-register\\node_modules',
     'C:\\Program Files\\nodejs\\node_modules',
     'C:\\Program Files\\node_modules',
     'C:\\node_modules' ] }
@madaz
Copy link

madaz commented Oct 4, 2016

Same problem on Windows 10, to start I use the the following cmd line
node C:\Users\[UserName]\AppData\Roaming\npm\node_modules\npm-register\server.js

@dgautsch dgautsch added the bug label Oct 14, 2017
@dgautsch
Copy link
Collaborator

Windows compatibility was recently added with #92 in v2.8.0

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

No branches or pull requests

3 participants