我刚刚构建了一个服务器并安装了NodeJS (从源代码编译)。我可以使用npm安装全局包,但不能在本地安装任何东西:
$ npm install restify
npm ERR! Error: Attempt to unlock restify@~2.6.2, which hasn't been locked
npm ERR! at unlock (/usr/local/lib/node_modules/npm/lib/cache.js:1304:11)
npm ERR! at cb (/usr/local/lib/node_modules/npm/lib/cache.js:646:5)
npm ERR! at /usr/local/lib/node_modules/npm/lib/cache.js:655:20
npm ERR! at /usr/local/lib/node_modules/npm/lib/cache.js:1290:7
npm ERR! at /usr/local/lib/node_modules/npm/node_modules/lockfile/lockfile.js:167:38
npm ERR! at OpenReq.Req.done (/usr/local/lib/node_modules/npm/node_modules/graceful-fs/graceful-fs.js:144:5)
npm ERR! at OpenReq.done (/usr/local/lib/node_modules/npm/node_modules/graceful-fs/graceful-fs.js:64:22)
npm ERR! at Object.oncomplete (fs.js:107:15)
npm ERR! If you need help, you may report this *entire* log,
npm ERR! including the npm and node versions, at:
npm ERR! <http://github.com/npm/npm/issues>
npm ERR! System Linux 3.5.0-23-generic
npm ERR! command "/usr/local/bin/node" "/usr/local/bin/npm" "install" "restify"
npm ERR! cwd /home/likewise-open/COVENTRY/aa7401/bookshop
npm ERR! node -v v0.10.26
npm ERR! npm -v 1.4.3
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /home/likewise-open/.../npm-debug.log
npm ERR! not ok code 0
$ 我正在运行当前版本的node和npm:
$ node -v
v0.10.26
$ npm -v
1.4.3
$我的请求包也有同样的问题。我是该文件夹和int包含的所有文件的所有者。有人知道这是怎么回事吗?
发布于 2014-03-11 02:39:21
该问题可能是主目录中.npm目录的权限问题。我很晚才发现这篇文章:
NPM cannot install dependencies - Attempt to unlock something which hasn't been locked
不幸的是,在我明天上班之前,我没有办法确认这一点。
https://stackoverflow.com/questions/22306722
复制相似问题