我在 Mac 上安装Cordova 3.5.0
时遇到了麻烦。它不断给我留言:
Error: Attempt to unlock cordova-ios@3.7.0, which hasn't been locked
at unlock (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/npm/lib/utils/locker.js:44:11)
at cb (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/npm/lib/cache/add-named.js:32:5)
at /usr/local/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/npm/lib/cache/add-named.js:41:20
at /usr/local/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/npm/lib/utils/locker.js:30:7
at cb (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/npm/node_modules/lockfile/lockfile.js:149:38)
at /usr/local/lib/node_modules/cordova/node_modules/cordova-lib/node_modules/npm/node_modules/lockfile/lockfile.js:177:38
at Object.oncomplete (fs.js:108:15)
我试图再次卸载并安装它,问题仍然存在。有人能给我解决方案吗? 谢谢!
答案 0 :(得分:3)
尝试使用sudo
sudo npm install -g cordova
答案 1 :(得分:0)
在遇到很多问题之后我得到了解决方案,只需在命令之前添加 sudo 命令
sudo cordova platform add ios