简体   繁体   English

从 Mingw32 在 Windows 上编译节点时如何设置环境变量?

[英]How to set env variables when compiling Node on Windows, from Mingw32?

I'm following the instructions from various Wikis on how to compile Node so I can eventually get it running as a service on Windows.我正在按照各种 Wiki 中关于如何编译 Node 的说明进行操作,因此我最终可以让它在 Windows 上作为服务运行。

My steps so far:到目前为止我的步骤:

  1. https://github.com/joyent/node/wiki/Installation (which lead to...) https://github.com/joyent/node/wiki/Installation (导致...)
  2. http://blog.tatham.oddie.com.au/2011/03/16/node-js-on-windows/ (successfully compiled via cygwin, but lead to...) http://blog.tatham.oddie.com.au/2011/03/16/node-js-on-windows/ (通过cygwin成功编译,但导致...)
  3. https://github.com/joyent/node/wiki/Building-node.js-on-mingw (which apparently is better than the so far successful cygwin compile) https://github.com/joyent/node/wiki/Building-node.js-on-mingw (这显然比迄今为止成功的cygwin编译要好)

So - I've managed to compile Node.exe using Cygwin but not the preferred Mingw.所以 - 我已经设法使用 Cygwin 编译 Node.exe,但不是首选的 Mingw。 I concur this isn't an ideal situation, building on Windows isn't the ideal.我同意这不是一个理想的情况,建立在 Windows 上并不理想。 Nevertheless.尽管如此。

The error I see in Mingw, once I've followed all of the steps above, occurs when I try to ./configure --without-ssl .一旦我按照上述所有步骤操作,我在 Mingw 中看到的错误就会在我尝试./configure --without-ssl时发生。 The error message is:错误信息是:

Danjah@PC /c/cygwin/home/Danjah/node-v0.4.7/node
$ ./configure –without-ssl
/usr/bin/env: python: No such file or directory

I understand from step 3's URL, that I must take steps to provide the environment variables for both Python and Git - using help from the provided URL I managed to input the Python path var, but I don't think I have the Git path var right. I understand from step 3's URL, that I must take steps to provide the environment variables for both Python and Git - using help from the provided URL I managed to input the Python path var, but I don't think I have the Git path var正确的。 Either way, in no install directories for Python, Cygwin or Mingw32 do I see the path specified in the error msg: " /usr/bin/env ".无论哪种方式,在 Python、Cygwin 或 Mingw32 的安装目录中,我都看到错误消息中指定的路径:“ /usr/bin/env ”。

Googling didn't really bring much to the table in terms of env variables or Mingw32, best I got was: PATH=C:\MinGW\bin;C:\MinGW\msys\1.0\bin where my install directory is at C:\MingW\ .就环境变量或 Mingw32 而言,谷歌搜索并没有真正带来太多好处,我得到的最好的是: PATH=C:\MinGW\bin;C:\MinGW\msys\1.0\bin我的安装目录位于C:\MingW\

The path I added to Windows environment vars for Python was: PythonPath=C:\Python27;C:\Python27\DLLs;C:\Python27\Lib;C:\Python27\Lib\lib-tk where Python 2.7 is installed in C:\Python27\ . The path I added to Windows environment vars for Python was: PythonPath=C:\Python27;C:\Python27\DLLs;C:\Python27\Lib;C:\Python27\Lib\lib-tk where Python 2.7 is installed in C:\Python27\

I hate it when a file path stops you from doing things, as I suspect is the problem here.当文件路径阻止你做事时,我讨厌它,因为我怀疑是这里的问题。 So please set me straight here - is it a file path problem I have or something else?所以请在这里直截了当-是我遇到的文件路径问题还是其他问题? And if its something else, please try and help me to get Node up and running... keen as to get experimenting.如果还有其他问题,请尝试帮助我让 Node 启动并运行......热衷于进行实验。

I should probably also mention that I do also have a previously installed version of Git on my Windows XP SP3 machine, but had not previously had Cygwin, Mingw32 or Python installed, and I do not have IIS running as a service - my usual testing environment is a WAMP stack. I should probably also mention that I do also have a previously installed version of Git on my Windows XP SP3 machine, but had not previously had Cygwin, Mingw32 or Python installed, and I do not have IIS running as a service - my usual testing environment是一个 WAMP 堆栈。

Windows uses the PATH environment variable to locate programs that are invoked without a fully qualified file path, ie 'python' rather than 'C:\Python27\python'. Windows 使用 PATH 环境变量来定位在没有完全限定文件路径的情况下调用的程序,即“python”而不是“C:\Python27\python”。

So you need to add python's home directory to the Windows PATH variable, as well as MinGW, git and anything else your script requires.因此,您需要python 的主目录添加到 Windows PATH 变量,以及MinGW、git 和脚本所需的任何其他内容。

Also by setting the PATH variable explicitly in your shell session or script, you are overwriting its original contents (in the local context) which limits which programs your shell can find to only those available within the PATH which is usually a bad idea.此外,通过在 shell session 或脚本中明确设置 PATH 变量,您将覆盖其原始内容(在本地上下文中),这限制了您的 Z2591C98B70119FE624898B1E424B 中的哪些程序通常只能在 PATHE4B5 中找到。

See http://www.java.com/en/download/help/path.xml for details on modifying your PATH so you can always run your Python scripts from the command line. See http://www.java.com/en/download/help/path.xml for details on modifying your PATH so you can always run your Python scripts from the command line.

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM