简体   繁体   English

Laravel中的node_modules文件夹是什么?

[英]What is the node_modules folder for in Laravel?

When I open a new Laravel project in PhpStorm I am asked to run npm install to install project dependencies. 当我在PhpStorm中打开一个新的Laravel项目时,需要运行npm install来安装项目依赖项。 I am assuming that Laravel has some node.js dependencies but searching on Google I can't find a definitive answer. 我假设Laravel有一些node.js依赖项,但是在Google上搜索时我找不到确切的答案。

  1. Are these node.js modules part of the Laravel project or some PhpStorm functionality? 这些node.js模块是Laravel项目的一部分还是PhpStorm功能的一部分?
  2. What part does it play in Laravel and/or PhpStorm? 它在Laravel和/或PhpStorm中扮演什么角色?

I'm using Laravel 5.7 我正在使用Laravel 5.7

The default install of Laravel includes a starter Vue.js application, as well as Webpack and Laravel Mix . Laravel的默认安装包括一个入门Vue.js应用程序以及Webpack和Laravel Mix These use Node. 这些使用Node。

If you don't intend to use these, you can safely remove node_modules , the starter Vue app, and package.json in your Laravel install. 如果您不想使用它们,则可以在Laravel安装中安全地删除node_modules ,starter Vue应用程序和package.json

They have nothing to do with PHPStorm. 他们与PHPStorm无关。

edit: In recent versions of Laravel, the command php artisan preset none will remove the Vue starter app . 编辑:在最新版本的Laravel中,命令php artisan preset none 不会删除Vue入门应用程序

When you install laravel you will got a folder called vendor in your project. 当您安装laravel时,您的项目中将有一个名为vendor的文件夹。 In this folder you have got all the pacakge dependencies of the laravel . 在此文件夹中,您具有laravel的所有pacakge依赖项 And All those packages and their dependencies are listed in composer.json . 所有这些软件包及其依赖项都列在composer.json中

Same as node_modules folder also contains the package dependencies related to your javascript projects. node_modules文件夹相同,还包含与您的JavaScript项目相关的软件包依赖关系。 So, that you can require it in your projects. 因此,您可以在项目中使用它。 And All those packages and their dependencies are listed in package.json . 所有这些包及其依赖项都列在package.json中

In your case if you are not using vue.js,react.js then you don't need to run npm install . 如果您不使用vue.js,react.js,则无需运行npm install You can start building project without worrying about node_modules. 您可以开始构建项目而不必担心node_modules。 You can even delete this folder and install it again using npm install when required. 您甚至可以删除此文件夹,并在需要时使用npm install再次安装

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM