我使用的是parcel,想清理.cache文件夹,同时在3000上运行React前端,同时在1234上运行后端,这些是我的启动脚本。
"scripts": {
"test": "jest --watchAll",
"start": "npm run build-client && node index.js",
"dev": "npm run dev-client & nodemon index.js",
"dev-peer": "cross-env GENERATE_PEER_PORT='true' nodemon index.js",
"build-client": "npm run clean && parcel build client/src/index.html --out-dir client/dist",
"dev-client": "npm run clean && parcel client/src/index.html --out-dir client/dist",
"clean": "rmdir /s/q .cache client/dist"
},
我已经把windows命令放在 "clean "脚本上,并使用了 rmdir /s/q
而得到
Invalid switch - "dist".
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] clean: `rmdir /s/q .cache client/dist`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] clean script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\shaun\AppData\Roaming\npm-cache\_logs\2019-07-09T11_49_08_194Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] dev-client: `npm run clean && parcel client/src/index.html --out-dir client/dist`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] dev-client script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\shaun\AppData\Roaming\npm-cache\_logs\2019-07-09T11_49_08_223Z-debug.log
你也可以使用rimraf npm模块,它在windows下也能正常工作。