【问题标题】:Windows Equivalent for package.json script commandspackage.json 脚本命令的 Windows 等效项
【发布时间】:2019-11-18 23:55:52
【问题描述】:

我正在使用 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"
  },

我已经使用rmdir /s/q 将 windows 命令放在“干净”脚本上,但得到

Invalid switch - "dist".
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! ajax27-blockchain@1.0.0 clean: `rmdir /s/q .cache client/dist`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the ajax27-blockchain@1.0.0 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! ajax27-blockchain@1.0.0 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 ajax27-blockchain@1.0.0 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

【问题讨论】:

    标签: npm node-modules package.json parcel


    【解决方案1】:

    您也可以使用 rimraf npm 模块,它也适用于 windows。

    【讨论】:

      猜你喜欢
      • 2018-08-02
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2010-09-16
      • 2011-10-16
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多