在ubuntu中用npm安装karma,jasmine和phantomjs的问题

时间:2015-12-27 10:37:18

标签: angularjs node.js npm phantomjs karma-jasmine

我正在尝试使用yeomen创建角度项目。我按照yeomen site中的说明安装了grunt-cli,bower,angular-generator。但是grunt构建不成功抛出以下未满足的依赖性错误。

npm WARN EPEERINVALID grunt-karma@0.12.1 requires a peer of karma@^0.13.0 || >= 0.14.0-rc.0 but none was installed.
npm WARN EPEERINVALID karma-jasmine@0.3.6 requires a peer of jasmine-core@* but none was installed.
npm WARN EPEERINVALID karma-phantomjs-launcher@0.2.2 requires a peer of karma@>=0.9 but none was installed.
npm WARN EPEERINVALID karma-phantomjs-launcher@0.2.2 requires a peer of phantomjs@>=1.9 but none was installed.

我尝试将未安装的依赖项安装为npm install -g karma@^0.13.0,安装成功。 这是终端中的跟踪。

srinivas@srinivas-Vostro-3500:~/workspace/cord-angApp$ npm install -g karma@^0.13.0
npm WARN install Couldn't install optional dependency: Unsupported
/home/srinivas/.node/bin/karma -> /home/srinivas/.node/lib/node_modules/karma/bin/karma

> bufferutil@1.2.1 install /home/srinivas/.node/lib/node_modules/karma/node_modules/bufferutil
> node-gyp rebuild

make: Entering directory `/home/srinivas/.node/lib/node_modules/karma/node_modules/bufferutil/build'
  CXX(target) Release/obj.target/bufferutil/src/bufferutil.o
  SOLINK_MODULE(target) Release/obj.target/bufferutil.node
  COPY Release/bufferutil.node
make: Leaving directory `/home/srinivas/.node/lib/node_modules/karma/node_modules/bufferutil/build'

> utf-8-validate@1.2.1 install /home/srinivas/.node/lib/node_modules/karma/node_modules/utf-8-validate
> node-gyp rebuild

make: Entering directory `/home/srinivas/.node/lib/node_modules/karma/node_modules/utf-8-validate/build'
  CXX(target) Release/obj.target/validation/src/validation.o
  SOLINK_MODULE(target) Release/obj.target/validation.node
  COPY Release/validation.node
make: Leaving directory `/home/srinivas/.node/lib/node_modules/karma/node_modules/utf-8-validate/build'
/home/srinivas/.node/lib
`-- karma@0.13.16 

在此之后我尝试了npm install并且可以看到相同的错误消息。我认为这是节点模块配置路径的问题?

1 个答案:

答案 0 :(得分:1)

由于我在npm install -g karma@全局安装了phantomjs,karma和jasmine,因此没有在本地安装。所以我只是在没有-g选项npm install karma的情况下安装它,这就解决了这个问题。