【发布时间】:2022-08-23 22:07:57
【问题描述】:
我在尝试在 Windows 10 上安装 Cordova 时遇到问题。
我遵循了关于如何通过安装 Node.js 和使用以下命令安装 Cordova 来安装它的官方 Cordova 教程:
npm install -g cordova
我通过检查全局 npm 文件并修复安装期间显示的漏洞来检查它是否已正确安装
C:\\WINDOWS\\system32>npm install -g cordova
npm WARN deprecated har-validator@5.1.5: this library is no longer supported
npm WARN deprecated uuid@3.4.0: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.
npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
added 178 packages, removed 148 packages, changed 303 packages, and audited 482 packages in 8s
45 packages are looking for funding
run `npm fund` for details
5 moderate severity vulnerabilities
To address all issues (including breaking changes), run:
npm audit fix --force
Run `npm audit` for details.
C:\\WINDOWS\\system32>npm -g list
C:\\Users\\Fabrice Arnout\\AppData\\Roaming\\npm
`-- cordova@11.0.0
C:\\WINDOWS\\system32>npm audit fix --force
npm WARN using --force Recommended protections disabled.
up to date, audited 1 package in 294ms
found 0 vulnerabilities
C:\\WINDOWS\\system32>
完成所有这些操作后,我仍然收到一条错误消息,提示找不到命令(法语):
C:\\WINDOWS\\system32>cordova
\'cordova\' n’est pas reconnu en tant que commande interne
ou externe, un programme exécutable ou un fichier de commandes.
C:\\WINDOWS\\system32>
因此,我尝试执行它所在的命令并收到该错误提示,这表明 powershell 未被识别为内部命令(法语):
C:\\Users\\Fabrice Arnout\\AppData\\Roaming\\npm> .\\cordova
C:\\Users\\Fabrice Arnout\\AppData\\Roaming\\npm\\node_modules\\cordova\\node_modules\\windows-release\\node_modules\\execa\\index.js:205
throw error;
^
Error: Command failed with exit code 1: powershell (Get-CimInstance -ClassName Win32_OperatingSystem).caption
\'powershell\' n\'est pas reconnu en tant que commande interne
ou externe, un programme ex�cutable ou un fichier de commandes.
at makeError (C:\\Users\\Fabrice Arnout\\AppData\\Roaming\\npm\\node_modules\\cordova\\node_modules\\windows-release\\node_modules\\execa\\lib\\error.js:59:11)
at Function.module.exports.sync (C:\\Users\\Fabrice Arnout\\AppData\\Roaming\\npm\\node_modules\\cordova\\node_modules\\windows-release\\node_modules\\execa\\index.js:188:17)
at windowsRelease (C:\\Users\\Fabrice Arnout\\AppData\\Roaming\\npm\\node_modules\\cordova\\node_modules\\windows-release\\index.js:39:19)
at osName (C:\\Users\\Fabrice Arnout\\AppData\\Roaming\\npm\\node_modules\\cordova\\node_modules\\os-name\\index.js:43:18)
at new Insight (C:\\Users\\Fabrice Arnout\\AppData\\Roaming\\npm\\node_modules\\cordova\\node_modules\\insight\\lib\\index.js:37:13)
at new RelentlessInsight (C:\\Users\\Fabrice Arnout\\AppData\\Roaming\\npm\\node_modules\\cordova\\src\\telemetry.js:33:1)
at Object.<anonymous> (C:\\Users\\Fabrice Arnout\\AppData\\Roaming\\npm\\node_modules\\cordova\\src\\telemetry.js:41:17)
at Module._compile (node:internal/modules/cjs/loader:1101:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
at Module.load (node:internal/modules/cjs/loader:981:32) {
shortMessage: \'Command failed with exit code 1: powershell (Get-CimInstance -ClassName Win32_OperatingSystem).caption\',
command: \'powershell (Get-CimInstance -ClassName Win32_OperatingSystem).caption\',
exitCode: 1,
signal: undefined,
signalDescription: undefined,
stdout: \'\',
stderr: \"\'powershell\' n\'est pas reconnu en tant que commande interne\\r\\n\" +
\'ou externe, un programme ex�cutable ou un fichier de commandes.\',
failed: true,
timedOut: false,
isCanceled: false,
killed: false
}
我显然不知道该怎么办。
标签: node.js windows powershell cordova npm