Giter Club home page Giter Club logo

Comments (4)

bnoordhuis avatar bnoordhuis commented on August 18, 2024

My hypothesis is that there's something in your environment that makes node-gyp (the build tool) think it's building for a UNIX system. It's supposed to build win_dummy.cc instead of unix_dgram.cc; there's a OS=="win" guard in binding.gyp to that effect.

What might work is node-gyp rebuild -- -DOS=win, although I don't know how you'd pass that through npm.

from node-unix-dgram.

Kresten avatar Kresten commented on August 18, 2024

I get the exact same error. I tried installing winston-syslog on windows 10 and get:

$ npm i winston-syslog
> [email protected] install C:\Users\Me\Projects\Project\node_modules\unix-dgram
> node-gyp rebuild 
C:\Users\Me\Projects\Project\node_modules\unix-dgram>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild )  else (node "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" rebuild )
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.   
  unix_dgram.cc
  win_delay_load_hook.cc
C:\Users\Me\Projects\Project\node_modules\unix-dgram\src\unix_dgram.cc(9): fatal error C1083: Cannot open include file: 'unistd.h': No such file or directory [C:\Users\Me\Projects\Project\node_modules\unix-dgram\build\unix_dgram.vcxproj]
gyp ERR! build error
gyp ERR! stack Error: `C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin\MSBuild.exe` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onExit (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\build.js:262:23) 
gyp ERR! stack     at ChildProcess.emit (events.js:198:13) 
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:248:12) 
gyp ERR! System Windows_NT 10.0.18362 
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Users\Me\Projects\Project\node_modules\unix-dgram
gyp ERR! node -v v10.16.3
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
...
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules\unix-dgram): 
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] install: `node-gyp rebuild` 
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1   

After the install, since it skipped unix-dgram "optional dependency", I tried running the file with require('winston-syslog') and i got:

 ERROR in ./node_modules/winston-syslog/lib/winston-syslog.js
Module not found: Error: Can't resolve 'unix-dgram' in 'C:\Users\Me\projects\project\node_modules\winston-syslog\lib'

I tried on my coworkers laptop, and he received the same error.

Please let me know if you need any more info, I will gladly provide and test things out :)

from node-unix-dgram.

bnoordhuis avatar bnoordhuis commented on August 18, 2024

@Kresten In your case it's because you're installing v2.0.3 but it's only 2.0.4 that has the win32 stub code.

winston-syslog loads unix-dgram lazily but keep in mind that unix-dgram doesn't actually work on Windows (it's a stub, after all) so it's not like it's a useful combination. Plain UDP-over-IP should work though.

from node-unix-dgram.

Kresten avatar Kresten commented on August 18, 2024

Thank you for the quick reply!
I installed the newest unix-dgram and got

$ npm i unix-dgram    
> [email protected] install C:\Users\Me\Projects\Project\node_modules\winston-syslog\node_modules\unix-dgram
> node-gyp rebuild 
C:\Users\Me\Projects\Project\node_modules\winston-syslog\node_modules\unix-dgram>
       if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild )  
       else (node "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" rebuild ) 
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.   
    unix_dgram.cc  
    win_delay_load_hook.cc 
C:\Users\Me\Projects\Project\node_modules\winston-syslog\node_modules\unix-dgram\src\unix_dgram.cc(9):
fatal error C1083: Cannot open include file: 'unistd.h': No such file or directory [C:\Users\Me\Projects\Project\node_modules\winston-syslog\node_modules\unix-dgram\build\unix_dgram.vcxproj]
gyp ERR! build error
gyp ERR! stack Error: `C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin\MSBuild.exe` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onExit (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\build.js:262:23) 
gyp ERR! stack     at ChildProcess.emit (events.js:198:13) 
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:248:12) 
gyp ERR! System Windows_NT 10.0.18362
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Users\Me\Projects\Project\node_modules\winston-syslog\node_modules\unix-dgram
gyp ERR! node -v v10.16.3  
gyp ERR! node-gyp -v v3.8.0    
gyp ERR! not ok       
> [email protected] install C:\Users\Me\Projects\Project\node_modules\unix-dgram    
> node-gyp rebuild      
C:\Users\Me\Projects\Project\node_modules\unix-dgram>
      if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild )  
      else (node "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" rebuild ) 
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.  
  win_dummy.cc    
  win_delay_load_hook.cc   
         Creating library C:\Users\Me\Projects\Project\node_modules\unix-dgram\build\Release\unix_dgram.lib and object C:\Users\Me\Projects\Project\node_modules\unix-dgram\build\Releas   e\unix_dgram.exp      
Generating code       
All 3 functions were compiled because no usable IPDB/IOBJ from previous compilation was found. 
Finished generating code      
unix_dgram.vcxproj -> C:\Users\Me\Projects\Project\node_modules\unix-dgram\build\Release\\unix_dgram.node  

I hope the first fail is intended to swap over to the dummy build :) The file runs fine now.
I'm only using the Syslog connection in production to connect to papertrail, since winston does not have an up-to-date papertrail transport.
Thanks again!

from node-unix-dgram.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.