sudo npm install bignum -g:OSError:[Errno 13]权限被拒绝

时间:2014-02-22 17:02:08

标签: node.js npm permission-denied bignum node-gyp

尝试安装bignum时出现此错误。

  

系统信息:

     

nodejs PPA ppa:chris-lea / node.js

     

node -v v0.10.26

     

npm -v 1.4.3

     

Ubuntu 12.04 2.6.32-042stab081.5

$ sudo npm install bignum -g
npm http GET http://registry.npmjs.org/bignum
npm http 304 http://registry.npmjs.org/bignum

> bignum@0.6.2 install /usr/lib/node_modules/bignum
> node-gyp configure build

Traceback (most recent call last):
  File "/usr/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py", line 18, in <module>
    sys.exit(gyp.script_main())
  File "/usr/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/__init__.py", line 534, in script_main
    return main(sys.argv[1:])
  File "/usr/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/__init__.py", line 527, in main
    return gyp_main(args)
  File "/usr/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/__init__.py", line 503, in gyp_main
    options.circular_check)
  File "/usr/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/__init__.py", line 129, in Load
    params['parallel'], params['root_targets'])
  File "/usr/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/input.py", line 2687, in Load
    generator_input_info)
  File "/usr/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/input.py", line 594, in LoadTargetBuildFilesParallel
    parallel_state.pool = multiprocessing.Pool(8)
  File "/usr/lib/python2.7/multiprocessing/__init__.py", line 232, in Pool
    return Pool(processes, initializer, initargs, maxtasksperchild)
  File "/usr/lib/python2.7/multiprocessing/pool.py", line 115, in __init__
    self._setup_queues()
  File "/usr/lib/python2.7/multiprocessing/pool.py", line 210, in _setup_queues
    self._inqueue = SimpleQueue()
  File "/usr/lib/python2.7/multiprocessing/queues.py", line 352, in __init__
    self._rlock = Lock()
  File "/usr/lib/python2.7/multiprocessing/synchronize.py", line 147, in __init__
    SemLock.__init__(self, SEMAPHORE, 1, 1)
  File "/usr/lib/python2.7/multiprocessing/synchronize.py", line 75, in __init__
    sl = self._semlock = _multiprocessing.SemLock(kind, value, maxvalue)
OSError: [Errno 13] Permission denied
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onCpExit (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:337:16)
gyp ERR! stack     at ChildProcess.EventEmitter.emit (events.js:98:17)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:797:12)
gyp ERR! System Linux 2.6.32-042stab081.5
gyp ERR! command "node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "configure" "build"
gyp ERR! cwd /usr/lib/node_modules/bignum
gyp ERR! node -v v0.10.26
gyp ERR! node-gyp -v v0.12.2
gyp ERR! not ok
npm ERR! bignum@0.6.2 install: `node-gyp configure build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the bignum@0.6.2 install script.
npm ERR! This is most likely a problem with the bignum package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node-gyp configure build
npm ERR! You can get their info via:
npm ERR!     npm owner ls bignum
npm ERR! There is likely additional logging output above.

npm ERR! System Linux 2.6.32-042stab081.5
npm ERR! command "/usr/bin/node" "/usr/bin/npm" "install" "bignum" "-g"
npm ERR! cwd /home/directory/directory
npm ERR! node -v v0.10.26
npm ERR! npm -v 1.4.3
npm ERR! code ELIFECYCLE
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR!     /home/directory/directory/npm-debug.log
npm ERR! not ok code 0
$

1 个答案:

答案 0 :(得分:1)

您可以尝试通过降级python版本来解决此问题。

sudo add-apt-repository ppa:fkrull/deadsnakes
sudo apt-get update
sudo apt-get install python2.6
sudo update-alternatives --install /usr/bin/python python /usr/bin/python2.6 20
sudo update-alternatives --install /usr/bin/python python /usr/bin/python2.7 10

切换

sudo update-alternatives --config python