当前位置: 首页 > 面试题库 >

在Ubuntu上安装Node-gyp时出错

刘弘新
2023-03-14
问题内容
npm http 200 https://registry.npmjs.org/weak/-/weak-0.2.2.tgz
npm http GET https://registry.npmjs.org/bindings
npm http 304 https://registry.npmjs.org/bindings

> weak@0.2.2 install node_modules/weak
> node-gyp rebuild

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())
AttributeError: 'module' object has no attribute 'script_main'
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:789:12)
gyp ERR! System Linux 3.11.0-15-generic
gyp ERR! command "node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"

gyp ERR! node -v v0.10.15
gyp ERR! node-gyp -v v0.12.1
gyp ERR! not ok 
npm ERR! weak@0.2.2 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the weak@0.2.2 install script.
npm ERR! This is most likely a problem with the weak package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node-gyp rebuild
npm ERR! You can get their info via:
npm ERR!     npm owner ls weak
npm ERR! There is likely additional logging output above.

npm ERR! System Linux 3.11.0-15-generic
npm ERR! command "node" "/usr/bin/npm" "install" "weak@0.2.2"
npm ERR! node -v v0.10.15
npm ERR! npm -v 1.3.23
npm ERR! code ELIFECYCLE

npm ERR! not ok code 0

我没有直接依赖于weak或node-gyp,但是我想我的其他依赖项(express,phantom,ejs,aws-
sdk,moment)都需要它。任何人都遇到这样的问题并能够解决?


问题答案:

这是有效的。在安装过程中需要python 2.6。

#!/bin/bash
#On Ubuntu Saucy:
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

#you can switch between 2.6 & 2.7 using:
sudo update-alternatives --config python

#Btw I installed node using ppa:chris-lea/node.js

https://github.com/TooTallNate/node-
gyp/issues/363



 类似资料:
  • 当我尝试在ubuntu上安装Yeoman时,我得到了以下错误。 编辑 尝试MortezaLSC的解决方案后-我得到以下错误

  • HTTP请求已发送,正在等待响应...404找不到2018-07-18 14:49:48错误404:找不到。

  • 我们有问题运行“NPM安装”在我们的项目。找不到某个文件: 对于我们来说,这个节点--陀螺似乎是一个永无止境的痛苦之源。一开始它抱怨它需要python,所以我们安装了它。然后它抱怨它需要我们安装的VCBuild,(使用.NET2.0SDK),现在我们出现了这个错误。这几乎就像是错误越来越模糊,感觉我们走上了一条错误的道路。 奇怪的是,我们团队中的其他人在运行NPM-Install时没有任何问题。

  • 我一直在尝试在ubuntu16上安装xampp(5.6.24)。04,但我遇到了以下错误- /opt/lampp/etc/httpd的第136行出现语法错误。conf:无法加载模块/mod_ssl。所以进入服务器:/opt/lampp/modules/mod_ssl。所以:无法打开共享对象文件:没有这样的文件或目录 我尝试过在互联网上搜索,但是找不到任何专门针对ubuntu的东西。 任何建议都可能

  • 我在ubuntu 14.04上安装libav时收到这个错误。 (正在读取数据库…357718个当前安装的文件和目录。)正在准备解压缩…/libvpx/x264_0-1_amd64.deb…正在解压缩x264(0-1)…dpkg:错误处理archive/home/prashant/libvpx/x264_0-1 _amd64-deb(--install):尝试覆盖“/usr/local/bin/vp

  • 问题内容: 我有一个使用和的NPM项目,都需要node-gyp来安装它们。当我这样做时,出现以下错误: 以前由于未安装Python 2.7而失败,现在是这样。这让我头疼。我该怎么办? 问题答案: 下面的答案代表手动安装,但是有一种简单得多的方法:自动安装。 以管理员身份打开Powershell并运行。 安装需要时间,但对我来说却像一个魅力!