首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使节点在cygwin中工作

使节点在cygwin中工作
EN

Stack Overflow用户
提问于 2014-06-04 02:15:55
回答 2查看 3.3K关注 0票数 7

我试着让节点在cygwin工作,我在挣扎.

安装C:\cygwin64的路径

存储节点的路径(windows )C:\Program Files\nodejs

CYGWIN

代码语言:javascript
复制
$ 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

代码语言:javascript
复制
>node --version
v0.10.28
>npm --version
1.4.9

然后,我使用卸载了节点,并尝试使用windows方法这里在cygwin中构建它。但是我在下面的./configuremake部件上遇到了麻烦。我做错什么了?

./configure:

代码语言:javascript
复制
$ ./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:

代码语言:javascript
复制
$ 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

注:我发现了类似的问题这里这里,但没有解决,不是因为缺乏尝试:

EN

回答 2

Stack Overflow用户

发布于 2015-08-11 02:10:48

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

代码语言:javascript
复制
./configure --dest-os linux

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

代码语言:javascript
复制
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

嗅嗅:(

票数 3
EN

Stack Overflow用户

发布于 2022-11-13 04:51:53

在cygwin中获取npm

我试图让npm命令运行,然后发现node -v命令是开箱即用的,而不是npm -v。在仔细挖掘之后,我发现这个命令在cygwin内部工作:

代码语言:javascript
复制
node "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" -v

如果你像我一样使用只是文件,我发现最符合人体工程学的方法是这样的:

代码语言:javascript
复制
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
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/24027945

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档