node.js - 如何永远使用 npm

标签 node.js npm forever

我正在尝试在我的 debian 10 vps 中运行此命令 forever start npm start但是我在终端中遇到了这个错误,

warn:    --minUptime not set. Defaulting to: 1000ms
warn:    --spinSleepTime not set. Your script will exit if it does not stay up for at least 1000ms
info:    Forever processing file: npm
(node:23858) Warning: Accessing non-existent property 'padLevels' of module exports inside circular dependency
(Use `node --trace-warnings ...` to show where the warning was created)
(node:23858) Warning: Accessing non-existent property 'padLevels' of module exports inside circular dependency
error:   Cannot start forever
error:   script /root/node_projects/tiktok/backend/npm does not exist.

这是我的 package.json 文件
{
  "name": "auth-graphql",
  "version": "1.0.0",
  "description": "",
  "main": "src/index.js",
  "engines": {
    "node": "10.11.0"
  },  
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "dev": "node -r esm ./src/index.js",
    "start": "nodemon -r esm ./src/index.js"
  },
  "author": "",
  "license": "ISC",
  "dependencies": {
    ...
    "esm": "^3.2.0",
    ...
  },
  "devDependencies": {
    "babel-cli": "^6.26.0",
    "babel-preset-env": "^1.7.0",
    "babel-preset-stage-2": "^6.24.1",
    "nodemon": "^1.18.4"
  }
}

我试过
forever start  esm ./src/index.js

forever start -c "npm start" ./

forever start -c "npm start" /path/dir/

forever --sourceDir /path/dir/ -c "npm start" /

我也遇到了几乎相同的错误,请我需要帮助,我该如何解决这个问题

最佳答案

试试这个命令:

forever start -c "npm start" ./

运行应用程序的特定目录:
forever start -c "npm start" /path/dir/

或使用此命令:
forever --sourceDir /path/dir/ -c "npm start" /

关于node.js - 如何永远使用 npm,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/62236455/

相关文章:

node.js - Docker Nodejs MongoDB

node.js - 在 digital ocean 水滴上连接我的域名

node.js - 如何使用永远运行npm服务?

javascript - 如何保护 AJAX 应用程序中的私有(private) REST API

node.js - 尝试对 sails js 项目进行 dockerize

node.js - 如何在 VS2015 中更新 Node 和 npm?

node.js - 访问 package.json 中的配置值

node.js - 是否可以在环境变量中没有 Python 路径的情况下运行 npm install

javascript - fatal error : CALL_AND_RETRY_LAST Allocation failed — process out of memory

node.js - 如何使用forever来运行Nuxt.js应用程序?