2011-05-21 31 views
4
Geos-Mac:hone georgiana$ npm list 
/Users/georgiana/local/hone 
├─┬ [email protected] 
│ ├── [email protected] 
│ ├── [email protected] 
│ └── [email protected] 
├── [email protected] 
└── [email protected] 

但是,一個簡單的腳本包含Node.js的Express模塊​​不能正常加載

var express = require('express').createServer(); 

嘗試使用快遞時非常

Error: Cannot find module 'express' 
at Function._resolveFilename (module.js:322:11) 
......... 

請注意,

Geos-Mac:hone georgiana$ npm express -v 
1.0.6 

Geos-Mac:hone georgiana$ node -v 
v0.5.0-pre 

任何想法?

+0

如果你輸入你看到了什麼模塊:在節點殼require.paths? – 2011-05-21 11:48:23

+0

'npm'在本地安裝模塊。所以你的代碼需要靠近'/ .node_modules /'文件夾。 – Raynos 2011-05-21 11:49:29

+0

的require_paths輸出 '> require.paths [ '/Users/georgiana/.node_modules', '/Users/georgiana/.node_libraries', '/用戶/喬治亞娜/本地/骨/ LIB /節點']' '> GEOS的Mac:node_modules喬治亞娜$ pwd' '/用戶/喬治亞娜/本地/骨/ node_modules' 'GEOS的Mac:node_modules喬治亞娜$ LS -lsa' '總0' '0 drwxr-XR -x 5 georgiana staff 170 May 21 13:55 .' '0 drwxr-xr-x 7 georgiana staff 238 May 21 13:54 ..' '0 drwxr-xr-x 2 georgiana staff 68 5月21日13:55 .bin' '0 drwxr-xr-x 9 georgiana staff 306 May 21 01:01 gentle' '0 drwxr-xr-x 13 georgiana staff 442 May 21 01:01 mysql' – Georgiana 2011-05-21 12:28:22

回答