CNode

Mac OS X 下运行 express app.js 出错。

Hhellworld发布于12 年前最后回复12 年前9 回复5254 浏览0 收藏

已经全局安装了,并且可用 express 命令 。但是还是会报错

错误如下:

module.js:340
throw err;
      ^
Error: Cannot find module 'express'
    at Function.Module._resolveFilename (module.js:338:15)
    at Function.Module._load (module.js:280:25)
    at Module.require (module.js:364:17)
    at require (module.js:380:17)
    at Object.<anonymous> (/Users/YeXiang/Documents/helloworld/app.js:1:77)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Function.Module.runMain (module.js:497:10) 

求好心人解答。

查看回复

回复 (8)

H
hellworld#1·12 年前

还要在npm install,?

J
jiyinyiyong#2·12 年前

贴关键代码看看? 提示模块找不到

H
hellworld#3·12 年前
引用 jiyinyiyong贴关键代码看看? 提示模块找不到

是的,就是提示express找不到。

B
bshy522#4·12 年前

配置 NODE_PATH环境变量. /usr/local/lib/node_modules

L
liuweifeng#5·12 年前
npm install -g express-generator
H
hellworld#6·12 年前

感谢。已解决。

H
hitbs228#7·12 年前

当前目录安装肯定可以

W
wangdonghui#8·12 年前

npm install express,在当前项目目录下安装

参与回复
登录后即可参与回复。登录