7

I am trying to get node to work in cygwin and I am struggling...

Path where cygwin is installed C:\cygwin64

Path where node is stored (windows install version)C:\Program Files\nodejs

CYGWIN

$ node --version
v0.10.28
$ npm --version
/cygdrive/c/Program Files/nodejs/npm: line 2: $'\r': command not found
/cygdrive/c/Program Files/nodejs/npm: line 4: $'\r': command not found
/cygdrive/c/Program Files/nodejs/npm: line 5: syntax error near unexpected token `$'in\r''
'cygdrive/c/Program Files/nodejs/npm: line 5: `case `uname` in

Windows CMD

>node --version
v0.10.28
>npm --version
1.4.9

I then uninstalled node and I tried to build it in cygwin using the windows method here. But I am having trouble with the ./configure and make parts below. what am i doing wrong?

./configure:

$ ./configure
ctrpp not found in WinSDK path--using pre-gen files from tools/msvs/genfiles.
{ 'target_defaults': { 'cflags': [],
                       'default_configuration': 'Release',
                       'defines': ['OPENSSL_NO_SSL2=1'],
                       'include_dirs': [],
                       'libraries': []},
  'variables': { 'clang': 0,
                 'gcc_version': 48,
                 'host_arch': 'x64',
                 'node_install_npm': 'true',
                 'node_prefix': '',
                 'node_shared_cares': 'false',
                 'node_shared_http_parser': 'false',
                 'node_shared_libuv': 'false',
                 'node_shared_openssl': 'false',
                 'node_shared_v8': 'false',
                 'node_shared_zlib': 'false',
                 'node_tag': '',
                 'node_use_dtrace': 'false',
                 'node_use_etw': 'true',
                 'node_use_mdb': 'false',
                 'node_use_openssl': 'true',
                 'node_use_perfctr': 'true',
                 'python': '/usr/bin/python',
                 'target_arch': 'x64',
                 'uv_library': 'static_library',
                 'v8_enable_gdbjit': 0,
                 'v8_enable_i18n_support': 0,
                 'v8_no_strict_aliasing': 1,
                 'v8_optimized_debug': 0,
                 'v8_random_seed': 0,
                 'v8_use_snapshot': 'true'}}
creating  ./config.gypi
creating  ./config.mk
cygwin warning:
  MS-DOS style path detected: C:\Users\User Name/.gyp
  Preferred POSIX equivalent is: /cygdrive/c/Users/User Name/.gyp
  CYGWIN environment variable option "nodosfilewarning" turns off this warning.
  Consult the user's guide for more details about POSIX paths:
    http://cygwin.com/cygwin-ug-net/using.html#using-pathnames

make:

$ make
/usr/bin/python tools/gyp_node.py -f make
make -C out BUILDTYPE=Release V=1
make[1]: Entering directory '/home/User Name/node/out'
Makefile:271: *** mixed implicit and normal rules.  Stop.
make[1]: Leaving directory '/home/User Name/node/out'
Makefile:45: recipe for target 'node' failed
make: *** [node] Error 2

NOTE: I have found similar questions here and here but no soltution not for the lack of trying :(

Community
  • 1
  • 1
HattrickNZ
  • 4,373
  • 15
  • 54
  • 98
  • 1
    Cygwin support was dropped a long time ago. So stop trying to make it work. Even if it does there is no knowing what could be broken. – user568109 Jun 05 '14 at 05:35
  • 1
    Why are you trying to use cygwin anyways? The windows port of node.js runs just fine. If you're trying to develop for linux specifically (maybe filesystem specific?), you're way better off running a Virtual Machine instead. – Avery Jun 10 '14 at 15:18

2 Answers2

3

It appears that ./configure grabs the OS type and tries to pull in Windows SDK utilities. You can get further if you force the OS type to linux:

./configure --dest-os linux

Unfortunately this gets you part of the way there. make starts to work, but fails because cygwin doesn't have a thread barrier implementation:

g++ [...] ../deps/debugger-agent/src/agent.cc
In file included from ../deps/uv/include/uv.h:61:0,
             from ../deps/debugger-agent/include/debugger-agent.h:25,
             from ../deps/debugger-agent/src/agent.cc:23:
../deps/uv/include/uv-unix.h:152:9: error: "pthread_barrier_t" does not name a type

sniff :(

0

Getting npm in cygwin

I was trying to get npm commands to run, then discovered that the node -v command was working out of the box, but not npm -v. After having a dig around I discovered that this command works inside cygwin:

node "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" -v

If you happen to be using justfiles like me, the most ergonomic way I've found to use it is something like this:


npm := 'node "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js"'
npx := 'node "C:\Program Files\nodejs\node_modules\npm\bin\npx-cli.js"'

npm-version:
 {{npm}} -v

build package:
 cd ./packages/{{package}} && {{npm}} run build

chantey
  • 4,252
  • 1
  • 35
  • 40