Ionic 尝试发布电容器插件时,'rm'未被识别为内部或外部命令

zf2sa74q  于 2022-12-09  发布在  Ionic
关注(0)|答案(1)|浏览(143)

我正在尝试发布一个电容器插件。根据错误,它无法识别rm。我正在使用Windows的Powershell(VC代码)。当npm发布在运行时,Powershell中会生成以下错误

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

package.json文件:

{
  "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"
  }
}

我尝试发布由npm generate命令生成的默认插件,不做任何更改,用于测试目的。

3qpi33ja

3qpi33ja1#

在Windows中,您应该使用

rd /s /q dist

rm在Linux和Mac中可用。
参考编号:

相关问题