0

次のチュートリアルThe Node Beginner Bookに従おうとしています

ノードとmongodbを正常にインストールしましたnode -vが、実行すると表示されv0.5.11-preますが、ファイルを保存して端末に書き込むと、次のエラーが表示さhello.jsHome/node/ますnode hello.js

ubuntu@ubuntu:~/Downloads$ node hello.js

node.js:201
        throw e; // process.nextTick error, or 'error' event on first tick
              ^ Error: Cannot find module '/home/ubuntu/Downloads/hello.js'
    at Function._resolveFilename (module.js:334:11)
    at Function._load (module.js:279:25)
    at Array.0 (module.js:470:10)
    at EventEmitter._tickCallback (node.js:192:40)

ここで私が間違っていることを見つけるのを手伝ってください。仮想マシンでUbuntuを使用しています。

4

1 に答える 1

2

あなたは間違ったディレクトリにいます。次のように、hello.jsがあるファイルに移動します。cd

cd $HOME/node
node hello.js
于 2012-04-26T11:54:25.120 に答える