'Express'不能被识别命令(windows) [英] 'Express' is not recognized command (windows)

查看:377
本文介绍了'Express'不能被识别命令(windows)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

好,我正在Windows上运行节点(7)。使用npm我刚刚将模块安装到d:\目录。因此我的文件结构如下所示:

  D:\ 
-myproject
-node_modules
-.bin
-express

然而,当我在这个'myproject '目录,我似乎不能运行'express',例如:

  D:\myproject\express site 
'express'不被识别为内部或外部命令,可操作的程序或批处理文件。

我做错了什么?

解决方案

我的猜测是您没有在全球安装Express。您可以使用以下命令在全局安装express(并因此可用于您的PATH)(请参阅 http://expressjs.com/guide.html):

  npm install -g express 

安装它的方式仅在您安装它的文件夹中可用,并且该方法没有任何问题。



如果express不在您的PATH中,可以通过输入完整路径来运行:

  \myproject\\\
ode_modules\.bin\express.cmd


Okay I am running node on windows (7). Using npm I just installed modules to d:\ directory. Therefore my files structure looks like the following:

D:\
  -myproject
     -node_modules
        -.bin
        -express

However, when I am in this 'myproject' directory, I can't seem to run 'express' for example:

D:\myproject\express site
'express' is not recognized as an internal or external command, operable program or batch file.

Am I doing anything wrong?

解决方案

My guess is that you didn't install Express globally. You can install express globally (and therefore available in your PATH) with the following command (see http://expressjs.com/guide.html) :

npm install -g express

The way you install it is available only in the folder that you installed it and there is nothing wrong with that approach. There is very little advantage of having it available globally.

If express is not in your PATH you can run it by entering the full path to it:

\myproject\node_modules\.bin\express.cmd

这篇关于'Express'不能被识别命令(windows)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆