简体   繁体   中英

Installing Node.js to use in PHP application

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.

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