【问题标题】:I'm unable to run the script through npm run command. My script name is "start". whenever i run this script through this command i got error我无法通过 npm run 命令运行脚本。我的脚本名称是“开始”。每当我通过此命令运行此脚本时,我都会遇到错误
【发布时间】:2023-04-11 01:52:01
【问题描述】:

实际上我正在尝试将我的应用程序部署到 Heroku(这与 Heroku 无关)。以前我只是通过运行 app.js(脚本名称)在本地机器上运行脚本。但现在我必须通过添加“start”:“node src/app.js”脚本来修改我的packege.json。但是每当我运行命令(npm run start)时,它都会产生错误。

我尝试过“start”:“node app.js”。我已经正确检查了脚本的位置,它在 src 文件夹中,但仍然无法正常工作。

{
      "name": "src",
      "version": "1.0.0",
      "description": "",
      "main": "app.js",
      "scripts": {
          "start": "node src/app.js"    // here I declare the start
  },

这个脚本必须启动服务器

【问题讨论】:

  • 您能否将错误信息添加到您的问题中?

标签: node.js


【解决方案1】:

你应该只需要运行npm start

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2016-07-06
    • 2021-08-01
    • 2014-05-11
    • 2018-07-19
    • 2017-09-13
    • 1970-01-01
    • 2021-03-20
    • 2019-03-21
    相关资源
    最近更新 更多