当我使用 sudo 在 Mac 上安装时,它似乎可以安装,但实际上并不是我尝试获取版本号所看到的那样。
这影响了我使用 ionic 1 和 ionic 2 的能力。我不能使用“ionic emulate ios”
$ sudo npm install -g cordova
npm WARN deprecated npmconf@2.1.2: this package has been reintegrated into npm and is now out of date with respect to npm
/usr/local/bin/cordova -> /usr/local/lib/node_modules/cordova/bin/cordova
cordova@6.0.0 /usr/local/lib/node_modules/cordova
├── underscore@1.7.0
├── q@1.0.1
├── ansi@0.3.1
├── nopt@3.0.1 (abbrev@1.0.7)
├── update-notifier@0.5.0 (is-npm@1.0.0, semver-diff@2.1.0, string-length@1.0.1, chalk@1.1.1, repeating@1.1.3, configstore@1.4.0, latest-version@1.0.1)
└── cordova-lib@6.0.0 (valid-identifier@0.0.1, opener@1.4.1, properties-parser@0.2.3, semver@4.3.6, nopt@3.0.6, dep-graph@1.1.0, shelljs@0.3.0, xcode@0.8.0, npmconf@2.1.2, request@2.47.0, cordova-serve@1.0.0, aliasify@1.9.0, tar@1.0.2, cordova-app-hello-world@3.10.0, init-package-json@1.9.3, cordova-js@4.1.3, npm@2.14.19)
但是,当我尝试获取版本号时出现错误
$ cordova --v
/usr/local/lib/node_modules/cordova/node_modules/update-notifier/node_modules/configstore/index.js:53
throw err;
^
Error: EACCES: permission denied, open '/Users/syedtariq/.config/configstore/update-notifier-cordova.json'
You don't have access to this file.
at Error (native)
at Object.fs.openSync (fs.js:549:18)
at Object.fs.readFileSync (fs.js:397:15)
at Object.create.all.get (/usr/local/lib/node_modules/cordova/node_modules/update-notifier/node_modules/configstore/index.js:34:26)
at Object.Configstore (/usr/local/lib/node_modules/cordova/node_modules/update-notifier/node_modules/configstore/index.js:27:44)
at new UpdateNotifier (/usr/local/lib/node_modules/cordova/node_modules/update-notifier/index.js:34:17)
at module.exports (/usr/local/lib/node_modules/cordova/node_modules/update-notifier/index.js:123:23)
at checkForUpdates (/usr/local/lib/node_modules/cordova/src/cli.js:64:20)
at cli (/usr/local/lib/node_modules/cordova/src/cli.js:116:5)
at Object.<anonymous> (/usr/local/lib/node_modules/cordova/bin/cordova:41:1)