我无法在npm中安装下划线。 获取以下错误

49 silly install resolved     main: 'underscore.js',
49 silly install resolved     version: '1.5.2',
49 silly install resolved     devDependencies: { phantomjs: '1.9.0-1' },
49 silly install resolved     scripts: { test: 'phantomjs test/vendor/runner.js test/index.html?noglobals=true' },
49 silly install resolved     licenses: [ [Object] ],
49 silly install resolved     files: [ 'underscore.js', 'underscore-min.js', 'LICENSE' ],
49 silly install resolved     bugs: { url: 'https://github.com/jashkenas/underscore/issues' },
49 silly install resolved     _id: 'underscore@1.5.2',
49 silly install resolved     dist:
49 silly install resolved      { shasum: '1335c5e4f5e6d33bbb4b006ba8c86a00f556de08',
49 silly install resolved        tarball: 'http://registry.npmjs.org/underscore/-/underscore-1.5.2.tgz' },
49 silly install resolved     _from: 'underscore@1.5.2',
49 silly install resolved     _npmVersion: '1.3.5',
49 silly install resolved     _npmUser: { name: 'jashkenas', email: 'jashkenas@gmail.com' },
49 silly install resolved     maintainers: [ [Object] ],
49 silly install resolved     directories: {},
49 silly install resolved     _shasum: '1335c5e4f5e6d33bbb4b006ba8c86a00f556de08',
49 silly install resolved     _resolved: 'https://registry.npmjs.org/underscore/-/underscore-1.5.2.tgz' } ]
50 info install underscore@1.5.2 into /home/miguel
51 info installOne underscore@1.5.2
52 verbose installOne of underscore to /home/miguel not in flight; installing
53 warn locking Error: EACCES, open '/home/miguel/.npm/_locks/underscore-9eac46d14df2c94b.lock'
53 warn locking     at Error (native)
53 warn locking  /home/miguel/.npm/_locks/underscore-9eac46d14df2c94b.lock failed { [Error: EACCES, open '/home/miguel/.npm/_locks/underscore-9eac46d14df2c94b.lock']
53 warn locking   errno: -13,
53 warn locking   code: 'EACCES',
53 warn locking   path: '/home/miguel/.npm/_locks/underscore-9eac46d14df2c94b.lock' }
54 verbose stack Error: Attempt to unlock /home/miguel/node_modules/underscore, which hasn't been locked
54 verbose stack     at unlock (/usr/local/lib/node_modules/npm/lib/utils/locker.js:66:11)
54 verbose stack     at cb (/usr/local/lib/node_modules/npm/lib/install.js:1017:5)
54 verbose stack     at /usr/local/lib/node_modules/npm/lib/install.js:1021:20
54 verbose stack     at /usr/local/lib/node_modules/npm/lib/utils/locker.js:40:9
54 verbose stack     at cb (/usr/local/lib/node_modules/npm/node_modules/lockfile/lockfile.js:149:38)
54 verbose stack     at /usr/local/lib/node_modules/npm/node_modules/lockfile/lockfile.js:177:38
54 verbose stack     at FSReqWrap.oncomplete (fs.js:95:15)
55 verbose cwd /home/miguel
56 error Linux 3.13.0-55-generic
57 error argv "/usr/local/bin/node" "/usr/local/bin/npm" "install"
58 error node v0.12.7
59 error npm  v2.11.3
60 error Attempt to unlock /home/miguel/node_modules/underscore, which hasn't been locked
61 error If you need help, you may report this error at:
61 error     



这个堆栈:

/home/miguel/.npm/_locks/underscore-9eac46d14df2c94b.lock failed { [Error: EACCES, open '/home/miguel/.npm/_locks/underscore-9eac46d14df2c94b.lock']

和这个:

Attempt to unlock /home/miguel/node_modules/underscore, which hasn't been locked

建议它的权限有问题。 请尝试运行此命令:

sudo chown -R $USER:$USER ~/.npm

要么:

sudo chown -R $USER:$GROUP ~/.npm
链接地址: http://www.djcxy.com/p/33015.html

上一篇: I cannot install underscore in npm. Get the following error

下一篇: Cannot find module 'browserify'