使用NPM安装lessc - UNABLE_TO_VERIFY_LEAF_SIGNATURE

时间:2013-08-11 13:55:19

标签: node.js less npm

我想安装NPM提供的 lessc 。 (在OSX上)

首先,我安装了当前版本的NodeJs:0.10.15 它包括NPM。

现在我启动着名的命令:

npm install -g lessc

我得到了这个错误:

npm install -g lessc
npm http GET https://registry.npmjs.org/lessc
npm http GET https://registry.npmjs.org/lessc
npm http GET https://registry.npmjs.org/lessc
npm ERR! Error: UNABLE_TO_VERIFY_LEAF_SIGNATURE
npm ERR!     at SecurePair.<anonymous> (tls.js:1350:32)
npm ERR!     at SecurePair.EventEmitter.emit (events.js:92:17)
npm ERR!     at SecurePair.maybeInitFinished (tls.js:963:10)
npm ERR!     at CleartextStream.read [as _read] (tls.js:463:15)
npm ERR!     at CleartextStream.Readable.read (_stream_readable.js:320:10)
npm ERR!     at EncryptedStream.write [as _write] (tls.js:366:25)
npm ERR!     at doWrite (_stream_writable.js:219:10)
npm ERR!     at writeOrBuffer (_stream_writable.js:209:5)
npm ERR!     at EncryptedStream.Writable.write (_stream_writable.js:180:11)
npm ERR!     at write (_stream_readable.js:573:24)

在网上,我找到了workaround

npm config set strict-ssl false

但是当我重新启动命令时,我现在得到了:

npm install -g lessc
npm http GET https://registry.npmjs.org/lessc
npm http 404 https://registry.npmjs.org/lessc
npm ERR! 404 'lessc' is not in the npm registry.
npm ERR! 404 You should bug the author to publish it
npm ERR! 404 
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, or http url, or git url.

npm ERR! System Darwin 12.4.0
npm ERR! command "node" "/usr/local/bin/npm" "install" "-g" "lessc"
npm ERR! cwd /Users/me
npm ERR! node -v v0.10.15
npm ERR! npm -v 1.3.5
npm ERR! code E404

我对NodeJs世界及其打包者都很陌生。

我可以做些什么来设法安装lessc

也许我忘记了一些env变量。

1 个答案:

答案 0 :(得分:15)

好的,这个问题很简单:

实际上我受到Play plugin的启发。

显示的命令是:

npm install -g lessc  // lessc nonexisting

而不是

npm install -g less

现在,通过上面指定的解决方法,它可以正常工作。