本文介绍了在ubuntu上安装topojson的麻烦的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在尝试安装topojson,按照Mike Bostock的让我们制作地图教程,我相信我已经设法获得了最新版本的Node.js和npm。 $ ogr2ogr也可以。我对编程和Ubuntu来说都是新手,并且衷心感谢一些彻底的帮助,为什么npm安装topojson -g会产生以下错误。当我用sudo尝试相同的命令时,会产生错误,如:npm ERR!注册表错误解析json和gyp ERR!堆栈错误:节点的pre版本无法安装,请使用--nodedir标志来代替

I've been trying to install topojson by following Mike Bostock's Let's Make a Map tutorial http://bost.ocks.org/mike/map/ and I believe I have managed to get the most recent version of Node.js and npm. $which ogr2ogr works as well. I'm quite new to programming and Ubuntu and would sincerely appreciate some thorough help as to why npm install topojson -g yields the following errors. When I try the same command with sudo it yields errors like: npm ERR! registry error parsing json and gyp ERR! stack Error: "pre" versions of node cannot be installed, use the --nodedir flag instead

谢谢!

npm ERR! Error: EACCES, open '/home/natecraft/.npm/7edf76d6-topojson.lock'
npm ERR!  { [Error: EACCES, open '/home/natecraft/.npm/7edf76d6-topojson.lock']
npm ERR!   errno: 3,
npm ERR!   code: 'EACCES',
npm ERR!   path: '/home/natecraft/.npm/7edf76d6-topojson.lock' }
npm ERR! 
npm ERR! Please try running this command again as root/Administrator.

npm ERR! System Linux 3.5.0-23-generic
npm ERR! command "/home/natecraft/.nvm/v0.10.15/bin/node" "/home/natecraft/.nvm/v0.10.15/bin/npm" "install" "topojson" "-g"
npm ERR! cwd /home/natecraft/Downloads/node-latest-install
npm ERR! node -v v0.10.15
npm ERR! npm -v 1.3.5
npm ERR! path /home/natecraft/.npm/7edf76d6-topojson.lock
npm ERR! code EACCES
npm ERR! errno 3
npm ERR! stack Error: EACCES, open '/home/natecraft/.npm/7edf76d6-topojson.lock'
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /home/natecraft/Downloads/node-latest-install/npm-debug.log
npm ERR! not ok code 0


推荐答案

首先,请检查您的版本node.js - 使用稳定版本,而不是devel版本。第二,调用npm命令作为超级用户。

First, please check your version of node.js -- use the stable version, not the devel version. Second, invoke the npm command as superuser.

$ sudo npm install -g topojson

到目前为止,当我将node.js切换到稳定版本时,TopoJSON安装运行良好。谢谢你的关注。

So far, when I switch my node.js into stable version, TopoJSON installation is running well. Thank you for your attention.

这篇关于在ubuntu上安装topojson的麻烦的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-30 06:05