ngCordova bower 错误 - 有什么解决办法吗?

ngCordova bower error - any ideas how to fix?

我已尝试确保我使用的是最新版本,因为我的 ngCordova 媒体插件出于某种原因无法正常工作。

我收到这个错误:

npm WARN locking Error: EACCES, open '/Users/SubjectiveEffect/.npm/_locks/bower-e8debc5417026b57.lock'
npm WARN locking     at Error (native)
npm WARN locking  /Users/SubjectiveEffect/.npm/_locks/bower-e8debc5417026b57.lock failed { [Error: EACCES, open '/Users/SubjectiveEffect/.npm/_locks/bower-e8debc5417026b57.lock']
npm WARN locking   errno: -13,
npm WARN locking   code: 'EACCES',
npm WARN locking   path: '/Users/SubjectiveEffect/.npm/_locks/bower-e8debc5417026b57.lock' }
npm ERR! Darwin 14.5.0
npm ERR! argv "node" "/usr/local/bin/npm" "install" "-g" "bower"
npm ERR! node v0.12.7
npm ERR! npm  v2.11.3

npm ERR! Attempt to unlock /usr/local/lib/node_modules/bower, which hasn't been locked
npm ERR! 
npm ERR! If you need help, you may report this error at:
npm ERR!     <https://github.com/npm/npm/issues>

npm ERR! Please include the following file with any support request:
npm ERR!     /Users/SubjectiveEffect/myApp/npm-debug.log

我不知道如何解决这个问题。

有人有什么想法吗?

编辑:我做了一些整理,卸载并重新安装。我现在在尝试 "bower install ngCordova"

时遇到此错误
"bower cached git://github.com/driftyco/ng-cordova.git#0.1.12-alpha
bower validate 0.1.12-alpha against git://github.com/driftyco/ng-cordova.git#*
bower ECMDERR Failed to execute "git ls-remote --tags --heads        git://github.com/driftyco/ng-cordova.git", exit code of #69 Agreeing to the    Xcode/iOS license requires admin privileges, please re-run as root via sudo.

Additional error details:
Agreeing to the Xcode/iOS license requires admin privileges, please re-run as root via sudo."

但是如果我尝试使用 sudo 运行 它,我会被告知:

"bower ESUDO Cannot be run with sudo

Additional error details:
 Since bower is a user command, there is no need to execute it with superuser permissions.
If you're having permission errors when using bower without sudo, please spend a few minutes learning more about how your system should work and make any necessary repairs."

有什么想法吗?

bower 抱怨说您运行将它设置为 root,这通常是一种不好的做法。你需要 运行 它作为 "bower --allow-root".

错误说明接受 Xcode/iOS 许可协议时出现问题,这是 cordova 的依赖项(为了让 iOS 仿真工作)。

我猜Xcode已经被npm/bower安装好了,你只需要第一次打开它(Cmd-Space,然后输入Xcode ) 接受许可协议,然后重新运行 bower install ngCordova.

如果还没有安装Xcode,手动安装可能更省事(详见here),打开一次,重新运行 bower install ngCordova.

顺便说一句,ilj 是对的,在 sudo 下 运行 npm 或 bower 通常是一种不好的做法。这导致了各种各样的蠕虫罐头。

我在使用 Ionic 时遇到了同样的问题。原因是xCode更新了新版本,更新后我没有接受条款也没有启动

只需打开 xCode 并重试。