windows - 让 Node 在 cygwin 中工作

标签 windows node.js

我正试图让 Node 在 cygwin 中工作,但我正在努力......

安装cygwin的路径C:\cygwin64

node存放路径(windows安装版)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 命令

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

然后我卸载 node 并尝试使用 Windows 方法在 cygwin 中构建它 here .但是我在下面的 ./configuremake 部分遇到了问题。我做错了什么?

./配置:

$ ./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
/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

注意:我发现了类似的问题herehere但没有解决方案不是因为缺乏尝试:(

最佳答案

似乎 ./configure 获取操作系统类型并尝试引入 Windows SDK 实用程序。如果您将操作系统类型强制为 linux,您可以更进一步:

./configure --dest-os linux

不幸的是,这会让您成为其中的一部分。 make 开始工作,但失败了,因为 cygwin 没有线程屏障实现:

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

嗅闻:(

关于windows - 让 Node 在 cygwin 中工作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24027945/

相关文章:

node.js - 在 flutter 中从 MultipartRequest 发送图像时无法检测到图像

javascript - CORS 与 Express.js 和 Angular2

c - 为什么我必须手动将 OpenGL 库与 MinGW 链接起来?

c - Windows 控制台 API

javascript - Adonis Lucid ORM 不返回数据

node.js - Elasticsearch 更新具有匹配 id 的文档

windows - IMFMediaSink无法在具有AMD GPU的PC上添加第二个音频输出流

python - 指定 Windows 使用 Anaconda Python 解释器

Windows 路径变量

node.js - 使用 node.js 发出 HTTP 请求会引发 EAFNOSUPPORT