操作系统:Windows 10 编辑器:VS Code 程序包管理器:Node js 重击: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"
},
]
}
我只想在本地主机上开始调试。另一种方法是通过谷歌浏览器调试,但这对我也不起作用。我希望有人可以帮助我。
答案 0 :(得分:1)
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
将此添加到package.json中的脚本