In which location install npm and npm module in existing CodeIgniter - php

I have already a CodeIgniter application using RestClient and mysql.Chat is running well via Push Notification.
Now Need to integrate real time chat with node js and socket.io. I am new for node js.
Please suggest where I install npm or include the npm module.
Thanks..

The node modules can be installed globally or locally. Usually it goes into root of the project.
Put your project dependencies into package.json file and then execute npm install command.
https://docs.npmjs.com/files/package.json

Related

Laravel 6 user auth page not working properly

Today I installed laravel 6.x version for a new project.
I have PHP 7.3 in my system so laravel 6 was successfully installed.
Then I run this command to set the Auth UI for VueJS.
artisan ui vue —auth
along with this command:
composer require laravel/ui --dev
But when I checked my login page, it was just an html skeleton.
I checked over the internet and found a solution and tried to run this command,
npm run dev
But still am getting an ugly login page without css and Js files. I checked for CSS and JS files but found no solution.
Anyone please help and tell me how can I setup the front end scaffolding.
Thanks in advance
The command to implement Auth is as follows:
composer require laravel/ui
php artisan ui vue --auth
If your Login and Register page only shows plain HTML. And CSS is not loading properly then run this two command:
npm install
npm run dev
OR
Simply you've to follow this two-step.
composer require laravel/ui
php artisan ui:auth
This will solve your problem for sure!
Check if your npm install shows any deprecation error,
if shows then go to nodejs official site https://nodejs.org/en/ and download and install latest one in your system.
Then in your terminal run:
npm install
npm run dev
That's it.
In your laravel public folder, css and js should have shown after that npm run dev command.
Now your login and register page should be nice looking as expected.
Do one thing,
1) Create app.css and put into project_name/public/css/
2) Create app.js and put into project_name/public/js/
I believe it will work.
If not, make sure you have used these commands before.
npm install
npm run dev
Thanks.

Using Ci/CD to publish php composer packages

I use a CI pipline runner called Drone.
We push to drone and it runs our tests then publishes an artifact.
That could be an NPM package, a new version of an app, or a Docker image.
How can I do this with a PHP Composer package. It seems composer publishes pacakges of git tags. Usually a normal workflow is to tag a version and CI picks up that tag and attempts to publish it on the package registry .... with composer it just runs off git tags so I could have a git tag that fails CI but is published on composer... thats CRAZY!

Minishift - How to compile assets using Laravel mix

I have a minishift instance running on my laptop. I am running a Laravel app on it and it's configured to use a private git repository (a copy of repo is present on my laptop from where I push the changes to the git repository). Now my question is
How do I compile assets on it using laravel mix after I make CSS changes on my local repository and push them to the git repo?
Till now I have tried to:
Run npm dev by logging in to minishift using SSH. But it gives the error npm not installed.
The npm package was added to the S2I base image only recently, it may not have got through to official images yet if using the Minishift from the CDK. It should have got through to CentOS based builder images that would be used by Origin based Minishift.
https://github.com/sclorg/s2i-base-container/issues/115
Where did you get Minishift from and what version?

Sylius-Standard admin panel : no css/js

I've installed the latest Sylius-Standard (based on Sylius 1.0#dev) and followed the quick tutorial. Everything is working fine except the admin panel, where CSS and JS return 500 when accessed in dev mode (via app_dev.php).
I can see that they are fetched from a path that does not include app_dev.php. For instance, app.js is fetched from http://my.local.domain/assets/admin/js/app.js, which returns a 500 because it tries to access the prod database that is not setup.
There should be no need to create the prod database or install prod assets to access the admin panel in dev mode — what am I doing wrong?
Sylius use a gulp library to manage css and js. The following command should fix your problem:
$ npm install
$ npm run gulp
Edit
After a few years, this is the proper answer: https://stackoverflow.com/a/59135635/4243630
In order to see a fully functional frontend you will need to install its assets.
Sylius uses Gulp to build frontend assets using Yarn as a JavaScript package manager.
Having Yarn installed, go to your project directory to install the dependencies:
$ yarn install
//Then build the frontend assets by running:
$ yarn build
We are on Sylius 1.2.x, we followed the official documentation
This sorted out that problem for us.
If you are on 1.x this is the link to the documentation
This should solve your problem.

Create a customized laravel base Project and install it for future projects

I install a new Laravel project and I have been applied Many changes on it for my own purposes. for Example my custom admin panel design and related css and javascript files.
In addition to, I added some packages that are required on whole project.
Now , if I want to Start a new Project , I must to install a fresh laravel Project and add those files and packages manually again that It takes a lot of time.
Is there a way that I could store this base laravel project on it (for example Github) and install it via composer?
Yes, you can use Github to create a private/public repository then when you start e new project you clone that repository and then use composer install command to get the dependencies.
Yes, it's possible.
Here are all the steps :
git clone xxx.git
composer install (make sure you have included .env.example in your git for the app key)
npm install
bower install
php artisan migrate (if, I hope, you use migrations)
gulp
And you are ready to work on your project.

Categories