Trouble installing topojson on ubuntu

老子叫甜甜 提交于 2019-12-07 02:59:33

问题


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

Thanks!

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

回答1:


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

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




回答2:


I came across this error when installing topojson (Debian 3.2.0-4-amd64). My steps to get things working (also discussed here).

Install node v 0.11.10

git clone https://github.com/joyent/node.git
cd node
git checkout v0.11.10
./configure && make
sudo make install

Remove debian gyp and install via npm:

sudo apt-get remove gyp
npm install -g gyp

Explicitly install contextify, although that was the version already installed.

npm install contextify@0.1.7

then, installing topojson should work

sudo npm install -g topojson


来源:https://stackoverflow.com/questions/18045124/trouble-installing-topojson-on-ubuntu

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!