简体   繁体   中英

npm-cache contains 100's of packages already

I installed node.js and npm on a new Windows 7 machine recently using the msi installer. When i looked in my users//appdata/roaming/npm-cache directory, it looked as if a cached copy of 150 packages was already there.

My question is, how did those get there? I thought that the msi installer had done it but now I don't think so.

It would be useful to know since I don't always have a network connection, and to be able to install from the cache would be helpful.

Basically, I would like to know if it's possible to just cache a bunch (if not all) current npm packages using one command. I know for a fact that I didn't cache all 150 of these packages myself, maybe I did a dozen tops.

@apsillers and @generalhenry are correct.

It appears that npm flattens all sub-dependencies into the npm-cache directory.

I verified this by deleting the npm-cache/jshint folder, and then doing npm install on a project that contained the grunt-contrib-jshint project, and jshint was majically re-added to the npm-cache directory.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM