Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Install NodeJS package without npm

Question:

How to install NodeJS package (like grunt-cli) manually without using npm?

Environment:

  • I have installed Windows 10 with "Bash on Ubuntu on Windows".
  • I have successfully installed NodeJS + Grunt in the "normal" Windows environment without Bash.
  • NodeJS is installed in the bash environment (Linux-subsystem)
  • Grunt is not yet installed in the (Linux-subsystem)

Background (why):

My colleague's grunt tasks was developed for an Ubuntu environment and calls bash commands directly which obviously does not work in a "normal" Windows environment. This is an experiment to see if it is possible to run his grunt tasks in "Bash on Ubuntu on Windows" however, I am stuck on the part where npm tries to download the packages (network libraries are not yet supported by Linux-subsystem so commands like curl does not work).

I am hoping to "skip" the download part of npm by manually copying the downloaded version from the Windows environment (or GitHub) into the "node_modules" directory in the Linux-subsystem.

However, I do not know how to configure npm that there was a new package added and that it may use that package now.

like image 638
Jasper Citi Avatar asked Sep 04 '26 08:09

Jasper Citi


1 Answers

You can copy all the packages you need with dependencies into node_modules directory and it will work fine.

I think the best way is install packages using npm on a "normal" computer. Then copy the node_modules directory on "normal" computer to your target directory.

like image 102
Yoshi Avatar answered Sep 06 '26 21:09

Yoshi



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!