Why I'm not able to run my Application server using "npm start" command and getting the error message related to start script.I am using Ubuntu OS

huangapple go评论64阅读模式
英文:

Why I'm not able to run my Application server using "npm start" command and getting the error message related to start script.I am using Ubuntu OS

问题

我正在创建一个PERN堆栈(PostgreSQL,Express,React.JS,Node.JS)应用程序。我从GitHub仓库下载了文件,用VS Code打开它,并尝试使用以下命令运行服务器。
命令:
npm start

但是我收到了这个错误消息
错误:
缺少脚本:“start”
而当我使用“npm run”命令查看脚本列表时,我收到了这个错误消息
错误:
echo "Error: no test specified" && exit 1

这是错误的截图
Why I'm not able to run my Application server using "npm start" command and getting the error message related to start script.I am using Ubuntu OS

英文:

I am making a PERN stack(PostgreSQL, Express,React.JS,Node.JS) application. I downloaded the file from github repo, opened it in VS code and tried to run the server using the following command.
Command:
npm start

But I am getting this error message
Error:
Missing script: "start"
And when I saw the list of scripts using the command of "npm run"
I got this error message
Error:
echo "Error: no test specified" && exit 1

Here is the screenshot of the error
Why I'm not able to run my Application server using "npm start" command and getting the error message related to start script.I am using Ubuntu OS

答案1

得分: 1

在你的情况下,启动服务器的命令是:

node index

或者

node index.js

在此之前,通过以下方式安装Node模块:

npm install
英文:

In your case the command to start the server is:

node index

or

node index.js

Before this install node modules via:

npm install

答案2

得分: 1

你可以发送Package.json文件的屏幕截图,因为脚本在那里有提到。

你可以尝试运行以下命令:

  1. npm run start
  2. 确保首先运行 npm init
  3. npm install
  4. node index.js
英文:

It will be good if you send Packege.json file Screen shot because script is mention there.

you try npm run start
Make sure first try npm init
npm install
node index.js

答案3

得分: 1

我建议您运行npm install命令。但是,如果您已经这样做了,您可以验证您要运行的npm命令是否在package.json文件中列出。

确保文件中还指定了正确的依赖项和版本。

英文:

I recommend you to run the npm install command. However, if you have already done so, you can verify if the npm command you are trying to run is listed in the package.json file.

ensure that you have the correct dependencies and versions specified in the file as well.

答案4

得分: 1

错误表示在 package.json 中缺少用于启动服务器的脚本。当您执行 npm start 时,实际上是尝试运行在 package.json 中定义的名为 start 的脚本。打开您的 package.json 文件,查找 scripts 部分,您应该在其中找到 start 脚本,并查看是否缺失。然后您可以找出问题所在。

确保 package.json 是通过 npm init 创建的,以便它包含该脚本。有时脚本也可能被命名为 run,在这种情况下,您可以使用 npm run 来启动服务器。

另一种运行的方法是使用 node 和您想要运行的文件,比如说,node index.js

如果您需要进一步帮助,请分享您的 package.json。

英文:

The error indicates that the script required to spin up the server is missing in the package.json. When you do npm start you are basically trying to run the script defined in package.json with the name start. Open your package json and search for scripts where in you should find the start script and see if its missing. You can then find what the issue is.

Make sure the package.json was created through npm init so it has the script. Sometimes scripts also have names like run so in that case you can spin up the server using npm run.

An alternative approach to run would be using node and the file you want to run. Like say, node index.js.

If you need further help then please share your package.json.

答案5

得分: 1

根据我的理解,这里的错误消息表明在 package.json 文件中没有所需的启动服务器的脚本。当您执行 npm start 时,它会尝试运行 package.json 中定义的脚本。要解决这个问题,请打开 package.json 并查找 scripts 部分以找到 start 脚本。看看它是否存在或是否正确定义。

我希望这能帮助到您。

英文:

As per my understanding, the error message here indicates that the script required to start the server is not present in the package.json file. When you execute npm start, it attempts to run the script defined in the package.json. To fix this issue, open package.json and look for the scripts section to find the start script. See if it is present or correctly defined.

I hope this would help.

答案6

得分: 1

似乎您在使用npm start命令运行应用程序服务器时遇到了问题,并且您怀疑您的项目的package.json文件中可能没有定义"start"脚本。以下是您可以解决此问题的方法:

打开项目的根目录,其中包含package.json文件。

package.json文件中查找"scripts"部分。它应该类似于这样:

"scripts": {
  "test": "jest",
  "start": "nodemon index.js" 
}

此外,请确保您也已经安装了nodemon包。

英文:

It seems like you're facing an issue running your application server using the npm start command, and you suspect that there might be no "start" script defined in your project's package.json file. Here's how you can address this issue:

Open your project's root directory where the package.json file is located.

Look for the "scripts" section in the package.json file. It should look something like this:

"scripts": {
  "test": "jest",
  "start": "nodemon index.js" 
}

Also, just make sure that you have installed the nodemon package as well.

答案7

得分: 0

错误指向package.json文件中启动服务器所需的脚本缺失。在执行“npm start”时,您实际上是尝试运行package.json中定义的名为“start”的脚本。要解决此问题,打开您的package.json文件,搜索“scripts”部分,并确保存在“start”脚本。如果缺少该脚本,可能是问题的原因。检查脚本并识别任何问题。
确保使用“npm init”创建package.json文件以包括所需的脚本。有时,脚本可能以不同的名称命名,例如“run”。在这种情况下,您可以使用“npm run”后跟脚本名称来启动服务器。

英文:

The error points to the absence of the script required to start the server in the package.json file. When executing "npm start," you are essentially attempting to run the script named "start" as defined in package.json. To resolve this issue, open your package.json file, search for the "scripts" section, and ensure that the "start" script is present. If it is missing, that may be the cause of the problem. Examine the script and identify any issues.
Make sure that the package.json file was created using "npm init" to include the necessary script. Sometimes, scripts might be named differently, such as "run." In such cases, you can start the server using "npm run" followed by the script name.

答案8

得分: 0

错误提示表明在 package.json 文件中未定义启动脚本。为了解决这个问题,请确保它在其中存在。打开 package.json 文件并查找 scripts

之后,尝试再次运行 npm start,应该可以成功启动你的应用程序。

英文:

The error indicates that start script is not defined in the package.json file. To resolve it, make sure it is present there. Open the package.json file and look for scripts.

After that, try running npm start again, and it should start your application successfully.

答案9

得分: 0

你可以查看 package.json 文件,确保启动脚本在其中。

英文:

You can look in the package.json file and make sure that the start script is present there.

答案10

得分: 0

开始脚本似乎不在package.json文件中。package.json文件应该类似于这样:

{
  "name": "pern-stack-app",
  "version": "1.0.0",
  "description": "一个PERN堆栈应用程序",
  "main": "index.js",
  // 其他内容
}

在那里会有一个scripts部分,您需要确保在其中定义了start,例如:

"scripts": {
  "start": "node index.js",
  "client": "cd client && npm start",
  "server": "nodemon index.js",
  "dev": "concurrently \"npm run server\" \"npm run client\""
}
英文:

The start script does not seem to be present in the package.json file. The package.json file should be something like this

  {"name": "pern-stack-app",
  "version": "1.0.0",
  "description": "A PERN stack application",
  "main": "index.js",
   .... and so on 
  }

There will be a scripts section there and you need to make sure start is defined there, for example

  "scripts": {
    "start": "node index.js",
    "client": "cd client && npm start",
    "server": "nodemon index.js",
    "dev": "concurrently \"npm run server\" \"npm run client\""
  },

答案11

得分: 0

"Start script is not defined in the package.json file, To fix this issue, ensure that the "start" script is included in the package.json file under the "scripts" section.
Execute "npm start" again."

英文:

Start script is not defined in the package.json file, To fix this issue, ensure that the "start" script is included in the package.json file under the "scripts" section.
Execute "npm start" again.

huangapple
  • 本文由 发表于 2023年7月20日 20:13:14
  • 转载请务必保留本文链接:https://go.coder-hub.com/76729734.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定