一个命令相当于执行两个命令
{
"name": "npm-test",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
// 直接就是在npm start,可以就是先npm i,然后在npm run serve
"start": "npm run install-missing-dependencies && npm run serve",
"install-missing-dependencies": "npm i",
"serve": "http-server"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"http-server": "^14.1.0"
}
}
- 关键代码:
// 直接就是在npm start,可以就是先npm i,然后在npm run serve
"start": "npm run install-missing-dependencies && npm run serve",
"install-missing-dependencies": "npm i",