没有findExpress命令

由于某种原因,在我的机器上使用npm install -g express在全局安装Express之后,如果我进入一个目录并尝试运行Express,出现以下错误:

 express: command not found. 

即使我用sudo运行,我仍然得到相同的输出。 我已经尝试了多个不同的解决scheme来解决这个问题,没有什么工 我已经通过homebrew安装了堆栈溢出的一些线程可能是一个问题,所以我完全卸载节点,并通过nodejs.org(我现在运行v0.10.26)安装程序重新安装节点,问题仍然存在。

如果我进入我的/usr/local/lib/node_modules Express中,但在/ usr / local / bin中,Express没有任何内容。 我不知道这是否是一个问题,但考虑到在该目录中有其他全局安装的节点包的二进制文件,我认为可能有错误的地方。

这是我安装时得到的确切输出:

 npm http GET https://registry.npmjs.org/express npm http 304 https://registry.npmjs.org/express npm http GET https://registry.npmjs.org/accepts/1.0.0 npm http GET https://registry.npmjs.org/type-is/1.0.0 npm http GET https://registry.npmjs.org/range-parser/1.0.0 npm http GET https://registry.npmjs.org/cookie/0.1.0 npm http GET https://registry.npmjs.org/fresh/0.2.2 npm http GET https://registry.npmjs.org/buffer-crc32/0.2.1 npm http GET https://registry.npmjs.org/send/0.2.0 npm http GET https://registry.npmjs.org/methods/0.1.0 npm http GET https://registry.npmjs.org/cookie-signature/1.0.3 npm http GET https://registry.npmjs.org/utils-merge/1.0.0 npm http GET https://registry.npmjs.org/merge-descriptors/0.0.2 npm http GET https://registry.npmjs.org/escape-html/1.0.1 npm http GET https://registry.npmjs.org/serve-static/1.0.1 npm http GET https://registry.npmjs.org/qs/0.6.6 npm http GET https://registry.npmjs.org/path-to-regexp/0.1.2 npm http GET https://registry.npmjs.org/parseurl/1.0.1 npm http GET https://registry.npmjs.org/debug npm http 304 https://registry.npmjs.org/cookie/0.1.0 npm http 304 https://registry.npmjs.org/type-is/1.0.0 npm http 304 https://registry.npmjs.org/buffer-crc32/0.2.1 npm http 304 https://registry.npmjs.org/methods/0.1.0 npm http 304 https://registry.npmjs.org/accepts/1.0.0 npm http 304 https://registry.npmjs.org/range-parser/1.0.0 npm http 304 https://registry.npmjs.org/cookie-signature/1.0.3 npm http 304 https://registry.npmjs.org/fresh/0.2.2 npm http 304 https://registry.npmjs.org/serve-static/1.0.1 npm http 304 https://registry.npmjs.org/qs/0.6.6 npm http 304 https://registry.npmjs.org/utils-merge/1.0.0 npm http 304 https://registry.npmjs.org/merge-descriptors/0.0.2 npm http 304 https://registry.npmjs.org/escape-html/1.0.1 npm http 304 https://registry.npmjs.org/path-to-regexp/0.1.2 npm http 304 https://registry.npmjs.org/parseurl/1.0.1 npm http 304 https://registry.npmjs.org/debug npm http 304 https://registry.npmjs.org/send/0.2.0 npm http GET https://registry.npmjs.org/mime npm http GET https://registry.npmjs.org/send/0.1.4 npm http GET https://registry.npmjs.org/mime npm http GET https://registry.npmjs.org/negotiator npm http 304 https://registry.npmjs.org/mime npm http 304 https://registry.npmjs.org/mime npm http 304 https://registry.npmjs.org/send/0.1.4 npm http GET https://registry.npmjs.org/range-parser/0.0.4 npm http GET https://registry.npmjs.org/fresh/0.2.0 npm http 304 https://registry.npmjs.org/negotiator npm http 304 https://registry.npmjs.org/range-parser/0.0.4 npm http 304 https://registry.npmjs.org/fresh/0.2.0 express@4.0.0 /usr/local/lib/node_modules/express ├── methods@0.1.0 ├── parseurl@1.0.1 ├── utils-merge@1.0.0 ├── merge-descriptors@0.0.2 ├── escape-html@1.0.1 ├── debug@0.8.0 ├── cookie-signature@1.0.3 ├── range-parser@1.0.0 ├── fresh@0.2.2 ├── qs@0.6.6 ├── buffer-crc32@0.2.1 ├── cookie@0.1.0 ├── path-to-regexp@0.1.2 ├── type-is@1.0.0 (mime@1.2.11) ├── send@0.2.0 (mime@1.2.11) ├── serve-static@1.0.1 (send@0.1.4) └── accepts@1.0.0 (negotiator@0.3.0, mime@1.2.11) 

随着Express 4.0.0的发布,它看起来像你需要做sudo npm install -g express-generator

你需要运行:

 npm install -gd express-generator 

原来用cli表示,现在cli分成独立的express-generator包。 本来生成的项目运行的是express节点app.js,因为httpserver在app.js中有相关的代码,现在这部分代码到工程目录bin/www下面,app.js只保留实现app逻辑代码,你需要运行bin/www 。 只是一个非常简单的应用程序和优化包依赖版本的变化。