Eu fiz isso adicionando / usr / local / share / npm / bin ao meu caminho. (via editar meu arquivo .bashrc)
export PATH=/usr/local/bin:/usr/local/lib:/opt/local/bin:/opt/local/sbin:/usr/local/share/npm/bin:$PATH
Sou novato no Node, mas tenho tentado instalar alguns módulos npm e depois do que parece ser uma instalação bem-sucedida, não consigo executar o novo aplicativo. Eu devo ter algum erro básico de configuração, como um local ausente no meu PATH ...
Por exemplo, executando:
npm install -g karma
Eu recebo:
npm http GET https://registry.npmjs.org/karma
npm http 304 https://registry.npmjs.org/karma
npm http GET https://registry.npmjs.org/glob
... (many, many GETs......)
> [email protected] install /usr/local/share/npm/lib/node_modules/karma/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws
> (node-gyp rebuild 2> builderror.log) || (exit 0)
CXX(target) Release/obj.target/bufferutil/src/bufferutil.o
SOLINK_MODULE(target) Release/bufferutil.node
SOLINK_MODULE(target) Release/bufferutil.node: Finished
CXX(target) Release/obj.target/validation/src/validation.o
SOLINK_MODULE(target) Release/validation.node
SOLINK_MODULE(target) Release/validation.node: Finished
/usr/local/share/npm/bin/karma -> /usr/local/share/npm/lib/node_modules/karma/bin/karma
> [email protected] install /usr/local/share/npm/lib/node_modules/karma
> node install-log4js.js
npm http GET https://registry.npmjs.org/log4js/0.6.2
npm http 304 https://registry.npmjs.org/log4js/0.6.2
npm http GET https://registry.npmjs.org/async/0.1.15
npm http GET https://registry.npmjs.org/dequeue/1.0.3
npm http 304 https://registry.npmjs.org/dequeue/1.0.3
npm http 304 https://registry.npmjs.org/async/0.1.15
[email protected] /usr/local/share/npm/lib/node_modules/log4js
├── [email protected]
└── [email protected]
[email protected] /usr/local/share/npm/lib/node_modules/karma
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected] ([email protected])
├── [email protected] ([email protected])
├── [email protected] ([email protected], [email protected])
├── [email protected] ([email protected], [email protected])
├── [email protected] ([email protected])
├── [email protected] ([email protected], [email protected])
├── [email protected] ([email protected], [email protected])
├── [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected])
└── [email protected] ([email protected], [email protected], [email protected], [email protected])
Mas quando eu tento executar:
➤ karma start
fish: Unknown command 'karma'
É claro que, se eu executar diretamente o caminho completo do karma, tudo funcionará bem:
/usr/local/share/npm/lib/node_modules/karma/bin/karma start
Starting Testacular Server (http://vojtajina.github.com/testacular)
-------------------------------------------------------------------
INFO [karma]: Karma server started at http://localhost:9876/
INFO [launcher]: Starting browser Chrome
INFO [Chrome 26.0 (Mac)]: Connected on socket id sNhp2l8FW6zQ0iQsiRgR
Chrome 26.0 (Mac): Executed 1 of 1 SUCCESS (0.108 secs / 0.004 secs)
Quando eu npm instalo algo, um link simbólico não é criado em algum lugar?
➤ which npm
/usr/local/bin/npm
➤ npm --version
1.2.14
Veja esta página de configuração do Karma .
Executar:
npm install karma-cli -g
Você deve conseguir executar karma start
agora.