簡體   English   中英

無法在 centos 服務器上運行 node express

[英]Can't run node express on centos server

我正在嘗試運行使用express --view pug urltracker安裝的快速應用程序。 我還執行npm install來安裝所有依賴項。

當我使用DEBUG=urltracker:* && npm start它時,它在localhost:3000上完美啟動,我的應用程序運行順利,但是當我將它安裝在 centos 7 服務器上時,同樣卡在[nodemon] starting `node./bin/www之后沒有任何反應。

我也試過這樣運行它DEBUG=backend./bin/www但它說-bash: ./bin/www: Permission denied OR sudo: ./bin/www: command not found

我可以執行像node app.js這樣的普通文件,它工作正常,但是當它作為服務器運行時,它不起作用。

這是我的 package.json

{
  "name": "urltracker",
  "version": "0.0.0",
  "private": true,
  "scripts": {
    "start": "nodemon ./bin/www"
  },
  "dependencies": {
    "body-parser": "~1.18.2",
    "cookie-parser": "~1.4.3",
    "debug": "~2.6.9",
    "express": "~4.15.5",
    "morgan": "~1.9.0",
    "pug": "2.0.0-beta11",
    "serve-favicon": "~2.4.5",
    "puppeteer": "^1.6.2",
    "puppeteer-select": "^1.0.3"
  },
  "devDependencies": {
    "eslint-plugin-mocha": "^4.11.0",
    "file-system": "^2.2.2",
    "jest": "^21.2.1",
    "js-comments": "^0.5.4",
    "lodash": "^4.17.13"
  }
}

我還嘗試使用supervisor./bin/www運行節點主管,但它說

Starting child process with 'node ./bin/www'
Watching directory '/home/admin/web/example.com/node/projects' for changes.
Press rs for restarting the process.

我還嘗試將端口更改為3001 in./bin/www 像這樣 - server.listen('3001', '0.0.0.0');

但沒有任何效果。 幫助。

Nodemon 未列在package.json和 centos 服務器上的依賴項列表中 nodemon 不存在。

請在 package.json 中添加 nodemon 依賴,然后運行 npm i 或將啟動腳本從"start": "nodemon./bin/www""start": "node./bin/www"

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM