我已经在数字海洋上创建了一个Node.js水滴。
我已经用FileZilla连接到服务器并上传了所有的Node.js文件(index.js、package.json等)。
我正在尝试使用node index.js启动服务器。上面写着
App is running at http://localhost:3000 in development mode
Press CTRL-C to stop
然而,我无法在数字海洋提供的公共IP地址或localhost:3000上看到该网站。
如何正确启动Node.js服务器?
编辑
我正在用这个(index.js的内容)设置服务器:
const expr
我在我的服务器中使用forever.js。当我运行forever start index.js时,它运行得很好,但当我调用node index.js时,它说:
The program 'nodejs' is currently not installed. You can install it by typing:
apt-get install nodejs
我试着运行which node,上面的消息也显示出来了。我很困惑。我的服务器上有没有安装node.js?
我正在尝试使用以下命令运行服务器:
node server/index.js
但我得到的是:
SyntaxError: Unexpected token >
at Module._compile (module.js:439:25)
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)
at s
我在我的网站上显示了一些从节点服务器返回的数据。一直工作到今天。现在,当我转到我的网页时,我在我的服务器控制台上得到了下面的错误。我在用户中使用Auth0作为登录。
UnauthorizedError: invalid algorithm
at C:\workspace\New\MyApp\node_modules\express-jwt\lib\index.js:100:22
at C:\workspace\New\MyApp\node_modules\express-jwt\node_modules\jsonwebtoken\index.js:155:18
at n
我试图使用Node.js部署一个非常基本的Google无服务器应用程序,但它一直在Google控制台上显示以下错误:
Provided module can't be loaded.
Is there a syntax error in your code?
Detailed stack trace: Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: /workspace/index.js
require() of ES modules is not supported.
require() of /workspac
我有一个用ES6编写的服务器,我需要在ElasticBeanstalk上运行它,每当我运行它时,我都会遇到以下错误 SyntaxError: Unexpected identifier
at Module._compile (internal/modules/cjs/loader.js:723:23)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at
每次使用第一个“导入”时,当我试图运行neo4j graphql应用程序时,我都会得到下面的错误。
PS C:\Users\grand-stack-starter-master\api> nodemon index.js
[nodemon] 1.19.1
[nodemon] to restart at any time, enter `rs`
[nodemon] watching: *.*
[nodemon] starting `node index.js src/index.js`
C:\Users\grand-stack-starter-master\api\src\index.js
我正在使用"got" for api请求。
在本地运行firebase函数时,它工作得很好。然而,当我尝试部署时,我得到了"SyntaxError:意外令牌*"。
! functions[app(us-central1)]: Deployment error.
Function failed on loading user code. Error message: Code in file index.js can't be loaded.
Is there a syntax error in your code?
Detailed stack tra
当我在CMD中运行一个示例js文件时。它显示错误一样的错误:找不到测试框架"mocha“。请帮我解决这个问题。
运行测试后的错误:
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
^^^^^^^
SyntaxError: missing ) after argument list
at exports.runInThisContext (vm.js:53:16)
at Module._compile (module.js:373:25)
at Objec
我在我的Windows机器上安装了一个mySQL服务器,我还安装了WSL,这样我就可以在我的Windows机器上使用linux的所有优点。我分配了一个JS,其中包含与数据库的连接,所以我运行的mySQL服务器一切正常,但是当我使用node index.js从WSL启动JS并尝试连接到数据库时,它会引发一个sql错误。
Server running on port 8080 , http://localhost:8080
/mnt/c/Users/ngkil/Documents/VSCode/WebDevAssignment2022/Backend/index.js:43