繁体   English   中英

如何通过 npm 启动我的 react-app? (缺少启动脚本?)

[英]How can i start my react-app via npm ? (start-script missing?)

操作系统:Windows 10 编辑器:VS 代码包管理器:Node js Bash:Cygwin 网络服务器:NginX

当我尝试启动我的单页应用程序时,我收到以下错误消息:

npm 错误! 缺少脚本:开始

这是我的 package.json:

  "name": "wztv",
  "version": "1.0.0",
  "description": "",
  "main": "lib_bundle.js",
  "bin": {
    "wztv": "moc.js"
  },
  "dependencies": {
    "babel-core": "^6.26.3",
    "babel-plugin-transform-react-jsx": "^6.24.1",
    "babel-preset-env": "^1.7.0",
    "browserify": "^16.2.3",
    "history": "^4.9.0",
    "react": "^16.8.6",
    "react-dom": "^16.8.6",
    "react-router-dom": "^5.0.1",
    "uglify-js": "^3.6.0",
    "uglifycss": "0.0.29"
  },
  "devDependencies": {
    "@babel/core": "^7.4.5",
    "@babel/preset-env": "^7.4.5"
  },
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "",
  "license": "ISC"
}

这是我的launch.json:

{
    "version": "0.2.0",
    "configurations": [
        {
            "type": "firefox",
            "request": "launch",
            "reAttach": true,
            "name": "Launch index.html",
            "file": "${workspaceFolder}/index.html"
        },
        {
            "type": "firefox",
            "request": "launch",
            "reAttach": true,
            "name": "Launch index.html",
            "file": "${workspaceFolder}/main.jsx"
        },
    ]
}

我只想在本地主机上开始调试。 另一种方法是通过谷歌浏览器调试,但这对我也不起作用。 我希望有人能帮我解决这个问题。

"scripts": {
    "start": "react-scripts start",
    "build": "react-scripts build",
    "test": "react-scripts test",
    "eject": "react-scripts eject"
  },

将此添加到 package.json 中的脚本

暂无
暂无

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

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