问题
I am trying to find a way to intall gruntjs without internet access. Is there a way to download an installer? Stack overflow is giving me a hard time about the format of this question and I"m not sure what else to write. It's a pretty straightforward request.
回答1:
Sort of. You'll need internet access at some point to acquire the Grunt source from Github. Grunt is a node module, and therefore needs to installed to the node_modules folder in your project. You can do this via npm
, but you can also obtain the source for the module and copy it directly into the folder.
Go to: https://github.com/gruntjs/grunt to acquire the Grunt source code, and move it to your node_modules folder.
This will install grunt... but you'll still have problems. Grunt has many dependencies, listed here: https://github.com/gruntjs/grunt/blob/master/package.json
"dependencies": {
"async": "~0.1.22",
"coffee-script": "~1.3.3",
"colors": "~0.6.0-1",
"dateformat": "1.0.2-1.2.3",
"eventemitter2": "~0.4.9",
"findup-sync": "~0.1.0",
"glob": "~3.1.21",
"hooker": "~0.2.3",
"iconv-lite": "~0.2.5",
"minimatch": "~0.2.6",
"nopt": "~1.0.10",
"rimraf": "~2.0.2",
"lodash": "~0.9.0",
"underscore.string": "~2.2.0-rc",
"which": "~1.0.5",
"js-yaml": "~2.0.2",
"exit": "~0.1.0"
},
"devDependencies": {
"temporary": "~0.0.4",
"grunt-contrib-jshint": "~0.6.4",
"grunt-contrib-nodeunit": "~0.2.0",
"grunt-contrib-watch": "~0.5.3",
"grunt-contrib-bump": "git://github.com/gruntjs/grunt-contrib-bump#b9bfc07",
"difflet": "~0.2.3",
"semver": "2.1.0",
"shelljs": "~0.2.5"
}
}
Each one of these dependencies would also need to be manually installed in the same fashion into a node_modules
folder inside of your projects' node_modules/grunt
folder. Each of those dependencies may have dependencies of their own, so you would then have to follow the same procedure there.
Because of this, while it's technically feasible to install Grunt without using npm
it's certainly not practical.
回答2:
You can install node on another machine, zip up your node_modules directory and send it to yourself (email, dropbox, whatever channel you have open), and then unpack it on the machine. 7-zip compressed it to about 1.3mb for me.
来源:https://stackoverflow.com/questions/19118992/is-there-an-offline-installer-for-gruntjs