$indexStats part 4 - mgeneratejs: command not found

I am unable to install mgeneratejs . I tried solutions provided in other link.

Did not help much.

vagrant@m312:~$ npm install -g mgeneratejs

npm ERR! System Linux 3.13.0-170-generic
npm ERR! command “/usr/bin/nodejs” “/usr/bin/npm” “install” “-g” “mgeneratejs”
npm ERR! cwd /home/vagrant
npm ERR! node -v v0.10.25
npm ERR! npm -v 1.3.10
npm ERR! syscall getaddrinfo
npm ERR! errno ENOTFOUND
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /home/vagrant/npm-debug.log
npm ERR! not ok code 0

Can someone share the detail steps to install mgeneratejs tool.

“mgenerate is no longer included with mtools. Please use https://www.npmjs.com/package/mgeneratejs instead.”

git clone https://www.npmjs.com/package/mgeneratejs

But not sure whats the next step.

that seems a connectivity issue. check the following:

1 Like

Thank you . I am able to ping from my vagrant machine .
vagrant@m312:~$ ping www.google.com

64 bytes from maa03s29-in-f4.1e100.net ( icmp_seq=1 ttl=57 time=11.7 ms

Also tried below also but no luck.
npm config set strict-ssl=false

it is not about the host’s connectivity, it is npm’s. please check back that link and make sure npm can connect to its package addresses.

Thank you Yilmaz.
Adding following in /etc/hosts helped . registry.npmjs.org

1 Like

mark that post as the solution :wink:

Nodejs and npm in the repositories of the VM we use in M312 is too old. Updating the VM may cause inconsistent behavior for the course content. Also, trying to install Nodejs into Linux system can be a pain at times.

I was searhing and I have found this Fast and simple Node.js version manager, built in Rust (github.com). I liked it because you don’t have to install it.

  • download “fnm-linux.zip” and open it into “shared” folder.
  • “vagrant ssh” into VM.
  • only a few commands to use:
eval $(/shared/fnm env)
/shared/fnm install 16
/shared/fnm use 16

And that’s it. nodejs and npm are ready to be used, blazing fast.

npm install -g mgeneratejs
mgeneratejs -n100 /shared/schema.json|mongoimport --collection mgendata --port 27017

It is too bad this javascript version do not insert into the database.

eval step is needed everytime you open a new console. it is an easy command yet you can add eval $(/shared/fnm env) to rc files.

Thank you @Yilmaz_Durmaz

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.