I am quite unfamiliar with npm, (I develop in python) and most of the time I just do what the tutorial says. But now I am stuck. I tried Tailwindcss in combination wit 'Vue 3' and followed the install steps from the website:website tailwind+Vue 3
npm init #vitejs/app my-project
cd my-project
npm install
npm install -D tailwindcss#latest postcss#latest autoprefixer#latest
npx tailwindcss init -p
And after adding some HTML and running:
npm run dev
everything works fine in the browser.
But then Iwant to build it for using in production I use
npm run build
and after some processing my dist folder is filled with an index.html and assets.
And here starts my problem. I was expecting that I could copy these files to my server and that it should serve my site. But All I see is a blank page.
I can't find the answer anywhere or others with same problems so I think its something stupid I just don't know. But what is it?
Hope someone can help me...
Try this, maybe something will work
https://dev.to/vonagedev/using-tailwind-css-with-vue-js-b1b
Webpack (and Vue-loader which is a Webpack loader for Vue.js components) can be configured to use PostCSS which is a Webpack loader for CSS.
It will look for the configuration inside a postcss.config.js file and can build the app with CSS from packages you add.
And, configure it using this code.
// postcss.config.js
const autoprefixer = require('autoprefixer');
const tailwindcss = require('tailwindcss');
module.exports = {
plugins: [
tailwindcss,
autoprefixer,
],
};
The demo app is also generated without any CSS assets. Instead, it uses CSS inside the components (which is fine). To include Tailwind CSS, create a CSS asset using your editor or the commands below.
# mkdir -p for making parents they don't exist
mkdir -p src/assets/styles/
touch src/assets/styles/index.css
Now add this code, which adds the various packages of the Tailwind CSS library.
/* src/assets/styles/index.css */
#tailwind base;
#tailwind components;
#tailwind utilities;
```
I am using laravel 8 and now I want install Vue.js. I am trying like this
composer require laravel/ui
php artisan ui vue
php artisan ui vue --auth
UPDATE: If you want to completely avoid Inertia / Livewire (Alpine.js) scaffolding in your Laravel ^8.0 applications and use Vue instead - install Laravel UI, which will most likely be maintained indefinitely (scaled to practical software lifetime).
Instructions for installing Vue (and old auth scaffolding) in your Laravel app:
run composer require laravel/ui
run php artisan ui vue for just installing Vue.
run php artisan ui vue --auth for scaffolding out the auth views.
run npm install && npm run dev
How ever, if you still want to use Vue.js with Livewire scaffolding, use the following instructions.
IMPORTANT: Please note that Vue.js takes control of the DOM once installed, detaching nodes and replacing it, removing other JS listeners. So, if you are using Livewire on the same page with Vue, the Alpine.js that comes with Livewire scaffolding wont work. As a workaround you can use Livewire VueJS support plugin.
run npm install --save vue
Add the following to your resources/js/app.js:
window.Vue = require('vue');
Vue.component('example-component', require('./components/ExampleComponent.vue').default);
const app = new Vue({
el: '#app',
});
Create an ExampleComponent.vue in the resources/js/components directory
<template>
<div>Hello World.</div>
</template>
<script>
export default {
mounted() {
console.log("Example component mounted");
}
};
</script>
Add <script src="{{ asset('js/app.js') }}" defer></script> in the <head> section of your layout file (resources/views/layouts/app.blade.php)
Add id="app" to <body> or main <div> in your layout file (resources/views/layouts/app.blade.php)
Add <example-component /> to your view
Run npm run dev or npm run watch
Finally, open up the devtools, and in the console log you should see Example component mounted
In laravel 8 project run following commands to install vue.js
run composer require laravel/ui
Install Vue php artisan ui vue
Install Vue with auth php artisan ui vue --auth
run npm install && npm run dev
I wasted so much time with this and don't want people to go through the same, so I will teach you how to install Vue.js and make it work fast.
If you want to start from scratch
replace the LaravelProject with your project name
laravel new LaravelProject
Install Vue.js on your Laravel 8 application
run the following commands
composer require laravel/ui
php artisan ui vue
php artisan ui vue --auth
npm install
npm run dev
npm run watch
Now that you have installed everything you need, go to a blade view and add the following code inside <body></body>
<div id="app">
<example-component />
</div>
<script src="{{ mix('/js/app.js') }}"></script>
If you did everything right you will see the following text on the rendering of your view
Example Component
Im an example component.
And in your console:
Component mounted.
You can install Vue 3 on your laravel project via three different ways:
Import it as a CDN package on the page
Download the JavaScript files and host them yourself
Install it using npm
1. Via CDN
include following code in your HTML file:
<script src="https://unpkg.com/vue#next"></script>
or use the following link for production:
https://cdnjs.com/libraries/vue
2. Download and Host yourself:
Download it from GitHub here:
https://github.com/vuejs/vue-next
3. Via npm
npm is the recommended installation method when building large scale applications with Vue. It pairs nicely with module bundlers such as Webpack (opens new window)or Rollup (opens new window). Vue also provides accompanying tools for authoring Single File Components.
Run this command in your terminal to get the latest stable version
$ npm install vue#next
Followed by:
npm install
Run a Command
npm install vue
In resources/js/bootstrap.js
window.Vue = require("vue/dist/vue.min");
And then run command
npm run dev
You can try npm install --save vue
You can install vue on laravel 8 by simply running below commands to install laravel ui:
composer require laravel/ui
And if you want authorizations such as login page, registartion page scaffolding then run below command from the folder where laravel project is installed:
php artisan ui vue
After running above commands run to install all dependencies and compile all style resources:
npm install
npm run dev
npm run watch
Setting up Vue in Laravel
run composer require laravel/ui
Install Vue php artisan ui vue
if you Install Vue with auth use php artisan ui vue --auth
add after in page master
run npm install
run npm run dev
run PHP artisan serve
In existing project of Laravel 8 it's better to do this installation which gets in one line:
npm i -D vue#next #vue/compiler-sfc vue-loader#next
For your project to work correctly it's also important to check webpack.mix.js, it should look this way:
mix.js('resources/js/app.js', 'public/js').vue()
.postCss('resources/css/app.css', 'public/css', [
//
]);
As well while working with project don't forget:
npm run watch
Hope it was helpful!
A pretty simple and straightforward set of instructions
https://laravel2020.com/2022/01/25/how-to-install-vue-3-on-an-existing-laravel-8-project/
**Install Vue + Laravel 8
composer create-project laravel/laravel projectName --prefer-dist
composer require laravel/ui
php artisan ui vue
npm install
npm run dev
npm i vue-loader
npm install vue-router vue-axios
npm run dev
Success.
I am using Nuxt with apollo for a project, Everything is working perfectly on a local server but on the live server, the CSS is broken for the plugins I used. I used these two plugins
vue-awesome-swiper
v-lazy-image
plugins: [
{ src: "~/plugins/vue-awesome-swiper", mode: "client" },
{ src: "~/plugins/v-lazy-image", mode: "client" }],
Here is a live demo chatfata.com. as you can see the slider is broken and blur effect in not removing after the image is render.
I am facing one more problem maybe its related to this as it's my first time using Graphql with NUXT.
On the live server, npm run build is not working. it gives some kind of node_modules/babel-loader/lib?? no recognizing the. .gql extension as you can see the screenshot
So I do npm run build on local server and upload the files to live server. I don't if both errors are related
I need help
Thanks
Run this command below:
npm install babel-loader #babel/core
And then run:
npm install && npm run build
I installed node.js, run apache via xampp, and configured my apache server so that I can use www.example.com as my practice server domain on my local machine.
I started my command prompt as admin and typed the following lines but and they all ran successfully:
install vue-cli
$ npm install --global vue-cli
create a new project using the "webpack" template
$ vue init webpack my-project
install dependencies and go!
$ cd my-project
$ npm install
$ npm run dev
I followed the cli installation section on https://v2.vuejs.org/v2/guide/installation.html
When I go to my folders, all the vue.js files are installed inside 'my-project', but when I go to my apache server at www.example.com or www.example.com/my-project, a blank page shows. And if I got into my index.html file in the 'my-project' folder and edit it to:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>project3</title>
</head>
<body>
<div id="app">sdfsf</div>
<!-- built files will be auto injected -->
</body>
</html>
I just get a blank page with the text sdfsf. What am I doing wrong? why isn't vue.js hello install screen page loading?
When you run:
npm run dev
It starts a Node JS server. The exact command can be found in package.json, and you can see the result by going to http://localhost:8080/.
Trying to start a new angular2-meteor project using
npm install angular2-meteor --save
Get a whole bunch of red errors (below) and I am not sure what they mean. I have already done
npm install npm -g
and
npm update -g
Here's the error:
I think you followed the Quick Start here.
angular2-meteor package has not been exposed to NPM yet.
Check this issue
UPDATE:
Refer here and here for latest tutorial.
Now you can install, follow these steps:
Update your meteor globally (If you already updated, then no need to do it again. And go here to check if there is a new version).
meteor update --release 1.3-rc.4
Run these in your terminal to create an angular2-meteor1.3 project:
meteor create --release 1.3-rc.4 hello
cd hello
npm install https://github.com/Urigo/angular2-meteor --save
npm install https://github.com/Urigo/angular2-meteor-auto-bootstrap --save
meteor remove blaze-html-templates
meteor add angular2-compilers
Remove main.js, main.html, main.css files in the client folder.
Then create these two files in your client folder:
// app.ts
import 'reflect-metadata';
import { bootstrap } from 'angular2-meteor-auto-bootstrap'
import { Component } from 'angular2/core';
#Component({
selector: 'app',
template: `<p>Hello World!</p>`
})
class App {}
bootstrap(App);
(Make sure you put import 'reflect-metadata'; first line before other import, otherwise it won't work.)
// index.html
<head>
<title>Hello</title>
</head>
<body>
<app></app>
</body>
At last, run meteor in the terminal and go to http://localhost:3000 to check your app.