'rm' is not recognized as an internal or external command when trying publish a capacitor plugin

跟風遠走 提交于 2021-02-10 03:59:26

问题


I am trying to publish a capacitor plugin. According to the error it is not able to recognize rm. I am using Window's Powershell (VC Code) The following error is being generated in the powershell when npm publish in run

PS C:\Users\xxxxx\Documents\demo-plugin> npm run build

demo-plugin@0.0.1 build C:\Users\xxxxx\Documents\demo-plugin
npm run clean && tsc


demo-plugin@0.0.1 clean C:\Users\xxxxxx\Documents\demo-plugin
rm -rf ./dist

'rm' is not recognized as an internal or external command,
operable program or batch file.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! demo-plugin@0.0.1 clean: `rm -rf ./dist`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the demo-plugin@0.0.1 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\xxxxxx\AppData\Roaming\npm-cache\_logs\2019-12-16T10_11_18_987Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! demo-plugin@0.0.1 build: `npm run clean && tsc`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the demo-plugin@0.0.1 build 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\xxxxxx\AppData\Roaming\npm-cache\_logs\2019-12-16T10_11_19_090Z-debug.log

The package.json file:

{
  "name": "demo-plugin",
  "version": "0.0.1",
  "description": "Demo",
  "main": "dist/esm/index.js",
  "types": "dist/esm/index.d.ts",
  "scripts": {
    "build": "npm run clean && tsc",
    "clean": "rm -rf ./dist",
    "watch": "tsc --watch",
    "prepublishOnly": "npm run build"
  },
  "author": "Puru",
  "license": "MIT",
  "dependencies": {
    "@capacitor/core": "latest"
  },
  "devDependencies": {
    "typescript": "^3.2.4",
    "@capacitor/ios": "latest",
    "@capacitor/android": "latest"
  },
  "files": [
    "dist/",
    "ios/",
    "android/",
    "DemoPlugin.podspec"
  ],
  "keywords": [
    "capacitor",
    "plugin",
    "native"
  ],
  "capacitor": {
    "ios": {
      "src": "ios"
    },
    "android": {
      "src": "android"
    }
  },
  "repository": {
    "type": "git",
    "url": "-"
  },
  "bugs": {
    "url": "-/issues"
  }
}

I am trying to publish the default plugin generated by the npm generate command without any changes for testing purposes.


回答1:


In Windows you should use

rd /s /q dist

rm is available in Linux and Mac.

Reference:

  • How to run rm command on windows 10?


来源:https://stackoverflow.com/questions/59354806/rm-is-not-recognized-as-an-internal-or-external-command-when-trying-publish-a

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!