Hi I'd like to install the package esprima for node.js, I want to get the AST of some JS code. But I can't find a way to download the package and install it in an offline pc.
Any ideas?
Hi I'd like to install the package esprima for node.js, I want to get the AST of some JS code. But I can't find a way to download the package and install it in an offline pc.
Any ideas?
If I understand correctly that you wish to install a working copy of esprima on a server that does not have an active connection to the Internet, you could always install it on a second machine that does have an Internet connection, zip up its directory, copy it to your offline machine and unzip it into your projects node_modules
directory.
If esprima requires compilation of some of its parts to run, you'd need to assure that the system you built esprima on was of the same architecture as your target system.
So, on your connected system:
cd MY_PROJECT
npm install esprima
tar zcf esprima.tgz ./node_modules/esprima/*
Copy the resulting esprima.tgz file to your offline system and:
cd MY_PROJECT
tar zxf esprima.tgz
Well at the end this worked for me:
1- After installing esprima in a pc with internet connection, open the console and type:
npm pack esprima
it will create the file in the current working directory, so change it before this command if you want
2- Copy the file to the pc without internet connection, open the console and type:
npm install path
And that's it. Probably the other answers here also work, but I find that in this case this is the simplest solution (probably because esprima doesn't have dependencies)