简体   繁体   English

npm 错误! 缺少脚本:“开发”

[英]npm ERR! Missing script: "dev"

I am trying to create a Dapp using truffle but when I reach the stage of using the command npm run dev it gives me an error saying MISSING SCRIP.我正在尝试使用 truffle 创建一个 Dapp,但是当我到达使用命令 npm run dev 的阶段时,它给了我一个错误,说 MISSING SCRIP。 my code is as follows:我的代码如下:

{
  "name": "eth-vreg",
  "version": "1.0.0",
  "description": "Blockchain vreg Powered By Ethereum",
  "main": "truffle-config.js",
  "directories": {
    "test": "test"
  },
  "scripts": {
    
    "dev": "lite-server",
    "test": "echo \"Error: no test specified\" && sexit 1"

  },

You need to specify the command to run when executing npm run .执行npm run时需要指定要运行的命令。 in this case node在这种情况下node

"scripts": {
  "dev": "node lite-server",
  "test": "echo \"Error: no test specified\" && sexit 1"
}

You can read more about the scripts property here .您可以在此处阅读有关scripts属性的更多信息。

if this is the full code of your package.json , then I think your JSON code is not valid.如果这是您的package.json的完整代码,那么我认为您的 JSON 代码无效。 Because you are missing closing } .因为你错过了关闭} And where is the dependency object?依赖对象在哪里?

This would be package.json这将是package.json

{
    "name": "eth-vreg",
    "version": "1.0.0",
    "description": "Blockchain vreg Powered By Ethereum",
    "main": "truffle-config.js",
    "directories": {
      "test": "test"
    },
    "scripts": {      
      "dev": "lite-server",
      "test": "echo \"Error: no test specified\" && sexit 1"
  
    }
}

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM