How to install specified directory using npm ?
Installing npm to a specific directory using the following simple steps :
First, check if Node is installed on your pc or laptop. In order to check if Node is pre-installed or not open up a terminal in mac or command prompt in windows and type the following command :
Now, if the Node version is displayed something like “v12.18.3″ then you may conclude that Node is pre-installed on the pc or laptop, if not then please refer this article and install node according to your PC requirement and version.
Now, our final step to install to a specific directory will be to make use of the –prefix option, Here we will be making use of the following command to install our npm package into a specific directory.
npm install --prefix ./(folder/sub_folder_name) <package name>
Installing npm package “animation” in the current directory and using below command:
npm install --prefix ./new animation
Now, as we have installed our required npm package into our desired sub-directory i.e “new”, we can check our “new” directory by opening it and we can see that the following package is successfully installed into the directory.
Updated Project structure:
Please Login to comment...