npm安装 <module> 持久性错误?(节点-吉普塞人建立?)
-
22-12-2019 - |
题
我试图安装jsdom这样的:
$ sudo npm install -g jsdom
# OR
$ sudo npm install jsdom
后一些成功的命令,将安装迅速失败,第一个错误消息之后 [....]
:
$ sudo npm install jsdom
npm http GET https://registry.npmjs.org/jsdom
npm http 304 https://registry.npmjs.org/jsdom
[....]
> contextify@0.1.7 install /home/yug/Desktop/QGis/WikiAtlas/1_shaded_relief/test/node_modules/jsdom/node_modules/contextify
> node-gyp rebuild
gyp: /home/yug/.node-gyp/0.10.25/common.gypi not found (cwd: /home/yug/Desktop/QGis/WikiAtlas/1_shaded_relief/test/node_modules/jsdom/node_modules/contextify) while reading includes of binding.gyp
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 3.8.0-35-generic
gyp ERR! command "node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/yug/Desktop/QGis/WikiAtlas/1_shaded_relief/test/node_modules/jsdom/node_modules/contextify
gyp ERR! node -v v0.10.25
gyp ERR! node-gyp -v v0.12.2
gyp ERR! not ok
npm http 304 https://registry.npmjs.org/domhandler
npm http 304 https://registry.npmjs.org/domelementtype
npm ERR! contextify@0.1.7 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the contextify@0.1.7 install script.
npm ERR! This is most likely a problem with the contextify 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 contextify
npm ERR! There is likely additional logging output above.
npm ERR! System Linux 3.8.0-35-generic
npm ERR! command "/usr/bin/node" "/usr/bin/npm" "install" "jsdom"
npm ERR! cwd /home/yug/Desktop/QGis/WikiAtlas/1_shaded_relief/test
npm ERR! node -v v0.10.25
npm ERR! npm -v 1.3.24
npm ERR! code ELIFECYCLE
npm http 304 https://registry.npmjs.org/qs
npm http 304 https://registry.npmjs.org/entities
....
暗示?这种错误也出现其他模块:
$sudo npm install -g topojson
#bug with `contextify@0.1.7 install` error as well.
如何解决?
编辑: 我试过了 sudo apt-get remove --purge nodejs npm topojson
然后重新安装通过各种方式。 甚至的时候 nodejs
重新安装是成功的,错误的停留, 所以我猜它是相当的上下文(node.gyp
? cwd
?...).删除/重新安装方式的尝试:
- ubuntu_setup.sh
- 与当地的过时的url
- 与url更新 https://github.com/joyent/node.git,
sudo add-apt-repository ppa:chris-lea/node.js
,- 和手工制作的
git clone https://github.com/joyent/node.git
(审判已取消) - 使用 各种其他的方式 :
- way1:ogoing
解决方案 2
似乎我找到了一种方法通过仔细删除所有节点有关的文件和文件夹,在我的计算机。
0.上下文: 我之前做了几次不成功的控制台整洁-ups,
sudo apt-get remove --purge nodejs npm topojson
随后-3个不同的方式来重新安装 nodejs
.我尝试了各种方式,从清理到重新安装,2&4倍。
1.终端清除: 让我们首先清理我的烂摊子的最深切可能的方式:
npm cache clean; bower cache clean; grunt clean;
sudo apt-get remove --purge nodejs npm topojson
然而,我注意到 这种深度清除没有净化/删除的节点安装模块的, 呆持久的。
2.手清除: 此外,我推动的清除另外一个方面清除对这两个 nodejs
和 node_modules
.我看着 所有 相关的文件夹,在我的电脑,近根(ubuntu: /home/<user>/
)更好。我很小心,删除所有以前安装的全球 .../node-modules/
文件夹中,而不删除当地的模块(当地具体的安装,它仍在工作).
3.重新安装: 然后以下机允许一个干净的重新安装:
sudo apt-get update
sudo apt-get install python-software-properties python g++ make
sudo add-apt-repository ppa:chris-lea/node.js
sudo apt-get update
sudo apt-get install nodejs
sudo npm install -g topojson jsdom
Afterwhat,我的文件转换通过国家预防机制模块 topojson
(根据自身上 jsdom
)工作的罚款:
cd /myfolder/
topojson -o output.topo.json input.geo.json
4.结论: 我可不确定为什么该文件的文件夹删除允许成功 sudo apt-get install nodejs
+ sudo npm install -g topojson
重新安装。但这没什么深刻的通过清理鼠标和递归删除 sudo rm -r [node related folder/file]
明确地锁定我的情况。
/!\ 可 非常小心 与 rm -r
递归删除. /!\
其他提示
因为你发现了从评论意见,这是一个非常常见的问题。那么常见的,事实上,提交人的jsdom已经证明它有权在自述文件为项目文件的储存库。
TL博士
你需要有一个C++编译器和Python2.7安装在机器上安装 contextify 这是一个依赖性的 jsdom.否则,jsdom安装将失败。
从自述上 审查页jsdom:
Contextify
Contextify是一个依赖性的jsdom,用于运行
<script>
标签内页。换句话说,它允许jsdom,其在运行Node.js运行串JavaScript在隔离环境中,伪装成一个浏览器的环境,而不是一个服务器。你可以看到如何这是一个重要特征。不幸的是,在做这样的魔术需要C++。在Node.js使用C++从JavaScript装置使用的"原模块"。 本机模块的编制时间安装,使他们的工作正是你的机;也就是说,你不要下载个contextify二进制从国家预防机制,而是建立一个地下载后从npm.
不幸的是,越来越C++编制内npm是安装系统可能会非常棘手,特别是为Windows用户。因此,一个最常见的问题jsdom试图使用它而无恰当的汇编工具安装。这里就是你需要编译Contextify,因而安装jsdom:
Windows
- 最近的一个拷贝版本的x86Node.js 为窗户,不64版本。
- 一个复制的视觉C++2010表达。
- 一个复制的Python2.7,安装了默认位置C:\Python27.
有一些轻微的修改本,可以工作;例如完整版本的Visual Studio通常工作,并且有时你甚至可以得到64个版本的Node.js 工作压力太大。但是棘手,因此从基础开始!
Mac
- 工业化需要安装
- "命令线工具对工业化"需要进行安装
- 启动模式一旦接受许可,等等。和确保它正确地安装
Linux
你会需要建立各种工具安装的样做,Python2.7,一个编译器的工具.如何安装这些将具体以你的发行版,如果您已经没有他们。
试着装 jsdom 之后再次满足上述要求用您的操作系统,并看到如果解决了它。
顺便说一句,你是得到相同的问题 topojson 因为它依赖于 d3 这反过来取决于 jsdom, ,因此它是一样的问题,安装jsdom.希望这可以帮助!
-编辑--
因为这听起来像你使用Ubuntu,我谨建议开始的以下命令:
sudo apt-get install build-essential
这将安装 让 和 g++ 和一些其他工具。这包和Python2.7大概是所有你需要成功地安装contextify.
解决方案1b: 我[嫌疑人][1] rm -r /home/<user>/local/lib/node_modules/
是关键因素解情况。你可以列全球(-g
)node_modules,然后删除有关一个(多个)(topojson
和/或 jsdom
和/或 node-gyp
)具体而言,然后重新安装(他们)。
命令: 在ubuntu,尝试...
cd /home/<user>/local/lib/node_modules/ #replace <user> by relevant user name to set your cwd
ls -1 # give the list of global modules names
rm -r /<module_name> #replace <module_name> by relevant name to remove it
sudo npm install -g <module_name> #replace <module_name> by relevant name for global install
注: topojson
取决于 jsdom
和 npm-gyp
.
[1]:没有尝试过,但是有意义的根据我的诊断。