I would like to use some NPM packages inside my PHP/Mysql applications xampp/htdocs folder but when I install it and run the command on CMD prompt, it installs the files elsewhere. How can I install them into the right folder?
You need to create a node_modules folder in your xampp/htdocs folder first.
If you just run install and there is no node_modules folder and no package.json file., the program recursively searches for a node_modules folder in the parent directories. You can auto-create the node_modules folder by using the flag --save-dev
as part of the npm install
command. If you intend on exporting/moving this project you should create a package.json file and use that instead.
Also, be sure you are not using the -g
flag as part of the install command as that will install the package in your global node_modules folder.