Home  >  Article  >  Web Front-end  >  What to do if node start reports an error

What to do if node start reports an error

藏色散人
藏色散人Original
2022-12-29 13:55:043808browse

Node start error solution: 1. Execute "node xx.js" directly in the terminal; 2. Add the start startup item "scripts": {"test": "echo \"Error: no test specified\" && exit 1","start":"node service.js"}"; 3. Execute "npm start" again.

What to do if node start reports an error

The operating environment of this tutorial: Windows 10 system, node v7.6.0 version, Dell G3 computer.

node start What should I do if I get an error?

The node terminal executes npm start and an error "npm ERR! missing script: start" appears

Open package.json with the following content

"scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  }

There are two solutions.

1. Execute node xx.js directly in the terminal

xx.js is the file you want to execute

2. Add the start startup item

 "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "start":"node service.js"
  }

Then execute npm start and it will be executed successfully

Recommended learning: "node.js video tutorial"

The above is the detailed content of What to do if node start reports an error. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn