简体   繁体   English

Nodejs安装错误/home/ubuntu/public_html/node_test.js'

[英]Nodejs installation error /home/ubuntu/public_html/node_test.js'

I am new to nodejs. 我是nodejs的新手。 I managed to install node.js on amazon EC2 server using this tutorial http://iwearshorts.com/blog/how-to-install-node-js-on-your-server/ 我设法使用本教程http://iwearshorts.com/blog/how-to-install-node-js-on-your-server/在Amazon EC2服务器上安装了node.js。

But when I run the code I get this error. 但是,当我运行代码时,出现此错误。 anyone know why this is happening and what I need to solve this. 任何人都知道为什么会这样以及我需要解决什么。

node.js:197
        throw e; // process.nextTick error, or 'error' event on first tick
          ^
Error: Cannot find module '/home/ubuntu/public_html/node_test.js'
   at Function._resolveFilename (module.js:332:15)
   at Function._load (module.js:279:25)
   at Array.0 (module.js:481:10)
   at EventEmitter._tickCallback (node.js:188:41)

You should post your primary .js file that you are running in node so we can find your exact problem. 您应该发布正在节点中运行的主要.js文件,以便我们找到确切的问题。

My guess is you are passing the wrong value to require . 我的猜测是您传递了require的错误值。 Pass a relative file path without the filename extension like this: var node_test = require("./public_html/node_test"); 传递不带文件扩展名的相对文件路径,如下所示: var node_test = require("./public_html/node_test");

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM