When I open a new Laravel project in PhpStorm I am asked to run npm install
to install project dependencies. I am assuming that Laravel has some node.js dependencies but searching on Google I can't find a definitive answer.
I'm using Laravel 5.7
The node_modules folder is used to save all downloaded packages from npm in your computer for the JavaScript project that you have. Developers are always recommended to do a fresh install with npm install each time they downloaded a JavaScript project into their computer.
node_modules/ − The npm package installed is node_modules. You can open the folder and see the packages available. src/ − This folder is where we will work on the project using Angular 7. Inside src/ you will app/ folder created during the project setup and holds all the required files required for the project.
The node_modules folder contains every installed dependency for your project. In most cases, you should not commit this folder into your version controlled repository. As you install more dependencies, the size of this folder will quickly grow. Furthermore, the package-lock.
On Unix systems they are normally placed in /usr/local/lib/node or /usr/local/lib/node_modules when installed globally. If you set the NODE_PATH environment variable to this path, the modules can be found by node. Non-global libraries are installed the node_modules sub folder in the folder you are currently in.
When you install laravel you will got a folder called vendor in your project. In this folder you have got all the pacakge dependencies of the laravel. And All those packages and their dependencies are listed in composer.json.
Same as node_modules folder also contains the package dependencies related to your javascript projects. So, that you can require it in your projects. And All those packages and their dependencies are listed in package.json.
In your case if you are not using vue.js,react.js then you don't need to run npm install . You can start building project without worrying about node_modules. You can even delete this folder and install it again using npm install when required.
The default install of Laravel includes a starter Vue.js application, as well as Webpack and Laravel Mix. These use 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.
They have nothing to do with PHPStorm.
edit: In recent versions of Laravel, the command
php artisan preset none
will remove the Vue starter app.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With