简体   繁体   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

Actually I'm trying to deploy my app to Heroku(it is not about a problem with Heroku).实际上,我正在尝试将我的应用程序部署到 Heroku(这与 Heroku 无关)。 Previously I was running the script on my local machine by just running app.js (script name).以前我只是通过运行 app.js(脚本名称)在本地机器上运行脚本。 but now I have to modify my packege.json by adding "start":"node src/app.js" script.但现在我必须通过添加“start”:“node src/app.js”脚本来修改我的packege.json。 But whenever I run the command (npm run start) it generates the error.但是每当我运行命令(npm run start)时,它都会产生错误。

I have tried "start":"node app.js".我试过“开始”:“节点 app.js”。 I have checked the location of the script correctly it is in the src folder but still is not working.我已经正确检查了脚本的位置,它位于 src 文件夹中,但仍然无法正常工作。

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

This script has to start the server此脚本必须启动服务器

You should just need to run npm start .你应该只需要运行npm start

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 我收到路径错误:[找不到模块] 每当我尝试在 VS Code 中运行任何与 npm 相关的命令时 - I got path error : [module not found] whenever I try to run any npm related command in VS Code 使用nodemon命令运行npm脚本 - Run npm script with nodemon command 为什么我的“npm start”脚本导致错误:“run”不是内部或外部命令、可运行程序或批处理文件 - Why is my 'npm start' script resulting in the error: 'run' is not recognized as an internal or external command, operable program or batch file 如何在单个npm运行脚本中将命令的结果传递给另一个命令的选项? - How do I pass the result from a command to another command's option in a single npm run script? 无法运行 npm 命令“错误:命令失败:npm run start” - Unable to run npm command "Error: Command failed: npm run start" 运行 npm start 创建 React 应用程序时缺少脚本 - Missing Script when I run npm start to create React app 当我尝试使用npm start命令运行React App时出错 - Error when I try run a React App with npm start command 无法通过npm脚本运行babel“babel:command not found” - Unable to run babel via npm script “babel: command not found” 为什么我不能在不调用脚本的情况下运行与我的 package.json 脚本相同的命令? - Why I can't run the same command that is my script of package.json without calling the script? 如何使用 npm 脚本运行 mocha? - How can I run mocha with npm script?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM