[英]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. 我想在我的PHP / Mysql应用程序xampp / htdocs文件夹中使用一些NPM软件包,但是当我安装它并在CMD提示符下运行命令时,它将在其他位置安装文件。 How can I install them into the right folder?
如何将它们安装到正确的文件夹中?
You need to create a node_modules folder in your xampp/htdocs folder first. 您需要首先在xampp / htdocs文件夹中创建一个node_modules文件夹。
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. 如果您只运行install并且没有node_modules文件夹,也没有package.json文件,则该程序将在父目录中递归搜索node_modules文件夹。 You can auto-create the node_modules folder by using the flag
--save-dev
as part of the npm install
command. 您可以在
npm install
命令中使用标志--save-dev
来自动创建node_modules文件夹。 If you intend on exporting/moving this project you should create a package.json file and use that instead. 如果打算导出/移动此项目,则应创建一个package.json文件,并改用它。
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. 另外,请确保未在安装命令中使用
-g
标志,因为这会将软件包安装在全局node_modules文件夹中。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.