not using nodes in laravel - laravel

Is that possible to completely remove node_modules folder from laravel app and not using it?
My app doesn't require any npm packages and I'm not using echo or pusher or any other API's that requires npm packages, then
Is it OK to remove this unnecessary folder in my app or somehow laravel
needs it to work?

If your project doesn't require node packages then you can remove it, it's not necessary to run Laravel project. But if you're using VueJS, or NodeJS then you need it.
composer update not download node packages, it only installs packages in vendor folder, node_modules is different which includes node packages.
If you want to install node packages, then use npm install command to install it again.
Hope this will helps you!

It is safe to remove the folder. The normal workflow would be to compile all CSS and JS files before deployment and copy them to the public/ directory, rendering the node_modules/ obsolete for deployment.
If anything breaks after you removed it, you can still bring it back with npm install.

Related

Install a dependency and save to package.json for a sub-package in yarn workspaces

I am trying to use Yarn Workspaces for my app that I am splitting into multiple packages such that I can share code between the mobile and web version of the app. Let me explain what I am trying to do with an example.
Let's say I currently have a mobile app called awesome-app. I am refactoring it by taking out the shared code and creating three packages as follows:
awesome-web
awesome-mobile
awesome-shared
Let's say I want to add new functionality to awesome-mobile for which I have to install depA to awesome-mobile. How can I do that such that yarn only installs depA and updates the package.json for the awesome-mobile. I tried using command yarn package <package-name> add depA but it ended up installing all the dependencies again which I want to avoid.
Also, let's say I want to use awesome-shared in awesome-web. Is there a yarn command such that it installs and updates the package.json for awesome-web automatically. Currently, I do it by hand and then I do yarn install in the root folder which ends up installing all the dependencies again.

How do I install vuetify directly from github?

When I try with
npm install vuetifyjs/vuetify#v1.5.2
I get "Cannot find package".
UPDATE:
There is a packages folder under which there is a vuetify directory.
I tried npm installing that folder. Everything appeared to go well until I started the dev server.
Now in the console log I see:
[Vuetify] Multiple instances of Vue detected
Seems to be related to https://github.com/vuetifyjs/vuetify/issues/4068 but I cannot tell what the solution is at this point.
I had the same issue to use my own version of Vuetify, waiting for my pull request being accepted.
Here what I did:
I build the vuetify project with my fix.
yarn
yarn build
Then I took the content of 'packages/vuetify' and put it in a new git repository. I remove the .gitignore to be able to commit built files (/es5, /lib, /lib-temp, /dist)
Finally I add this git repository to my project to replace my vuetify version:
npm install git+https://gitlab.com/GITLABUSERNAME/REPOSITORYNAME.git
Looking at the package.json file, the package doesn't have a name property, which it would need to have for you to be able to install it from GitHub.
So the short answer is that you can't install vuetify directly from GitHub via npm.
However, you can install it directly from npm:
npm install vuetify#1.5.2
You can't install vuetify directly from GitHub but you can edit code in 1 component node_modules/vuetify/lib/components/VSlider/VSlider.js Then, you install patch-package and execute path package vuetify Delete node modules and execute yarn to create new node modules Last, yarn serve, you see your code is work
https://www.npmjs.com/package/patch-package

Is npm install affecting Laravel project?

I am working on the Laravel project, and intend to use Vue.js as its client-side scripting. When I searched the internet, I found that I had to use the npm install command. My question is if I run the order, will it affect the project I'm working on?
For example, in the directory structure or variable section?
It will change only package.json and /node_modules folder (it will download vue.js last version package into this folder) in your root directory. But it won't affect your existing codebase until you don't use them via importing or accessing it. It is like installing a package with composer, but not using it. The downloaded package will stay in /vendor folder and package name in composer.json, composer.lock

Is node_modules folder still needed after Laravel Mix compiled the assets?

node_modules folder is quite large in term of size. I wonder if we can delete it after Laravel Mix compile everything? Sure, I tried it before (install jquery) and then delete node_modules folder after Laravel Mix compiled everything. My jquery code still running and there's no error at all. So is it okay?
yes, you can remove it after run:
npm run production
after run this command all necessary codes will save in app.js
and when need node_modules you can download them again with :
npm install
You should never commit your node_modules folder to git. That would take forever. Just commit package.json and package-lock.json.
However, you wouldn't want to have to re-install them everytime you build your code. I checked a large project and the total size is 310 M. What situation do you have where you can't keep that in place?
To directly answer your question, Laravel will never run code from the node_modules folder, all of the code used from there is compiled into app.js, so it is safe to delete if you had to.

which node modules is my nwjs app using?

I have a lot of modules in the node_modules folder of my nwjs app. I want to know which ones are not used (anymore) by my app so I can uninstall them.
I suspect I haven't always added --save or --save-dev to the npm install command.
How can I find out which ones are used by nwjs and which ones I added without using --save?

Resources