簡體   English   中英

我無法通過 npm 運行命令運行腳本。 我的腳本名稱是“開始”。 每當我通過此命令運行此腳本時,我都會收到錯誤

[英]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

實際上,我正在嘗試將我的應用程序部署到 Heroku(這與 Heroku 無關)。 以前我只是通過運行 app.js(腳本名稱)在本地機器上運行腳本。 但現在我必須通過添加“start”:“node src/app.js”腳本來修改我的packege.json。 但是每當我運行命令(npm run start)時,它都會產生錯誤。

我試過“開始”:“節點 app.js”。 我已經正確檢查了腳本的位置,它位於 src 文件夾中,但仍然無法正常工作。

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

此腳本必須啟動服務器

你應該只需要運行npm start

暫無
暫無

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

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