Windows 7中的cmd无法识别express [英] express is not recognized in cmd in windows 7

查看:116
本文介绍了Windows 7中的cmd无法识别express的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

js,我已经从以下位置执行了以下命令

js on my windows 7 machine, i have executed the below commands from

C:\ node> npm install -g express -generator

C:\node> npm install -g express -generator

以及C:\ node> npm install -g express -generator @ 4,还有npm link express

and also C:\node> npm install -g express -generator@4, and also the npm link express

对于以上命令,我收到了以下消息.

for the above commands, i got the below messages.

express@4.10.7 C:\Users\user1\AppData\Roaming\npm\node_modules\express
├── methods@1.1.1
├── finalhandler@0.3.3
├── cookie-signature@1.0.5
├── serve-static@1.7.2
├── merge-descriptors@0.0.2
├── utils-merge@1.0.0
├── range-parser@1.0.2
├── media-typer@0.3.0
├── cookie@0.1.2
├── content-disposition@0.5.0
├── parseurl@1.3.0
├── vary@1.0.0
├── escape-html@1.0.1
├── fresh@0.2.4
├── path-to-regexp@0.1.3
├── depd@1.0.0
├── qs@2.3.3
├── on-finished@2.2.0 (ee-first@1.1.0)
├── etag@1.5.1 (crc@3.2.1)
├── debug@2.1.1 (ms@0.6.2)
├── type-is@1.5.5 (mime-types@2.0.7)
├── accepts@1.1.4 (negotiator@0.4.9, mime-types@2.0.7)
├── send@0.10.1 (destroy@1.0.3, ms@0.6.2, mime@1.2.11, on-finished@2.1.1)
└── proxy-addr@1.0.4 (forwarded@0.1.0, ipaddr.js@0.1.5)

并带有npm链接表示:

and with npm link express:

C:\ node \ node_modules \ express-> C:\ Users \ user1 \ AppData \ Roaming \ npm \ node_modul es \ express

C:\node\node_modules\express -> C:\Users\user1\AppData\Roaming\npm\node_modul es\express

但是当我在C:/node>执行express nodetest1时,仍然无法识别出Express.

but still when i execute the express nodetest1 at C:/node> i am getting the express is not recognized error.

任何人都知道任何指针都会有所帮助.

anyone know any pointers would be helpful.

推荐答案

您在上方express-generator之间有一个空格...如果复制粘贴了它,也许您错过了它...应该express-generator作为一个单元.

You have a space between express and -generator above... if this was copy-pasted, maybe you missed it... it's supposed to be express-generator as a single unit.

确保%USERPROFILE%\AppData\Roaming\npm都存在并且在您的PATH环境变量中...如果不存在,则必须在添加后打开一个新提示.某些版本的节点安装程序并不总是正确创建或添加.

Make certain that %USERPROFILE%\AppData\Roaming\npm both exists and is in your PATH environment variable... If it isn't there, you will have to open a new prompt after adding it. Some versions of node's installer don't always create or add it correctly.

如果您正在使用[用于Windows的nvm ],则需要确保C:\Program Files\nodejs在您的路径中(安装程序应该可以正常运行),您需要通过命令提示符Run as Administrator运行nvm.这是因为nvm使用从全局安装路径到您的配置文件下的特定版本的符号链接来运行.

If you are using [nvm for windows] you will need to ensure that C:\Program Files\nodejs is in your path (the installer should work correctly), you'll need to run nvm via command prompt Run as Administrator. This is because nvm uses symbolic links from the global install path to a specific version under your profile to run against.

我使用nvm for windows已有几个月了(从0.10.x和0.11.x版本切换),使用起来要容易一些.

I've been using nvm for windows for a few months now (switching from 0.10.x and 0.11.x versions) and it's been a bit easier to work with.

这篇关于Windows 7中的cmd无法识别express的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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