getting empty app.js file after running npm run dev - php

i'm using laravel 7.0 on windows 10. I'm following freecodecamp tutorial on youtube for laravel.
when i run npm run dev i got errors i updated npm by using this command "npm install npm#latest" and everything working fine and i ran npm run dev and i got no errors. but in resources folder and further in js folder i got nothing but "require('./bootstrap');" only and also in sass folder i did not get variable.scss file but in tutorial he have all things good like in app.js file it has vue.js content.

Related

Vite manifest not found

I Working on project that working with laravel 9 and Vite with laravel-vite,
In Dev environment all thing working fine, but in production cPanel server I has this issue
Vite manifest not found at: /home/???????/cart_shop/public/build/manifest.json
# With
Missing Vite Manifest File
Did you forget to run `npm install && npm run dev`?
I tried to solve the problem but nothing work, I need to change the public folder and the sup folder build file place from vite.config.js but I don't find the way to do that.
Note that: the file sequence is changed in cPanel shared server from
- home
- public_html
- cart_shop
- Root
- public
- etc
To
- home
- public_html
- public files and folders // I changed the index URLs too.
- cart_shop
- Root
- etc
my vite.config.js config is like:
import { defineConfig } from 'vite';
import laravel from 'laravel-vite-plugin';
import vue from '#vitejs/plugin-vue';
export default defineConfig({
plugins: [
laravel({
input: 'resources/js/app.js',
}),
vue({
template: {
transformAssetUrls: {
base: null,
includeAbsolute: false,
},
},
}),
],
});
I had the same issue only because of node version. I upgraded to the latest version and it's working properly.
For Ubuntu use n module from npm in order to upgrade node:
sudo npm cache clean -f
sudo npm install -g n
sudo n stable
To upgrade to latest version (and not current stable) version, you can use:
sudo n latest
You may need also to Fix PATH:
sudo apt-get install --reinstall nodejs-legacy # fix /usr/bin/node
To undo:
sudo n rm 6.0.0 # replace number with version of Node that was installed
sudo npm uninstall -g n
You may need to restart your terminal to see the updated node version.
Found in Ask Ubuntu
Type this it's works for me
npm run build
In my case, I have solved this problem by doing some things.
First of all, I have installed npm by running this command
npm install
After that, I have run
npm run dev
And finally, I have run
npm run build
And one thing I have noticed is my problem is not solved somehow and for that, i have run some command,
php artisan optimize:clear
and after running this command I have run those commands that i have run previously
And finally my problem is solved.
Update Node.js to its latest version: https://nodejs.org/en/
Then run npm run dev.
Remove #vite(['resources/sass/app.scss', 'resources/js/app.js']) from the <head> of the file app.blade.php on Laravel 9. And now it works like a charm.
The issue solved,
first: I try adding publicDirectory configration into laravel-vite-plugin setting in vite.config.js that solve the build issue but manifest still not founded.
Finally: I move all files and folders except build from public to bublic_html then npm run build and it's working fine.
just go to your public folder and there is a hot file in that file there is a link like this http://127.0.0.1:3000 change this link to your domain link i mean your website link
If the manifest.json file does exist but you're still seeing this error, make sure the permissions are good:
sudo chown www-data:www-data -R public/build/
sudo chmod g+w -R public/build/
I had a similar problem and I was able to resolve it by installing the node current stable version. In my case, the node version was 14+, and when I upgraded to the current version which is v16.17.0, everything works just fine. The comments here were helpful.
Visit the official node website to download and install the latest node version.
I solved this problem like this:
npm run build
When you put public files inside public_html. Create a public file in the root of the domain and put the build folder inside it And it was done.
Initially, this is your configurations in the package.json file, You can change the settings in your scripts or just run the vite build command on the terminal.

How to fix Vite manifest not found at: /app/public/build/manifest.json?

It works locally just fine, but as I deploy it to a host, this popped up, not sure what to look or what to do.
Any suggestions? thanks
I would suggest running npm install && npm run dev as this seems like a default laravel app.
This would generate the correct files for local development.
If you want to run this in production you should run npm run prod somewhere in your build pipeline.
In my case, the
npm run build
command did the work.

gulp command not working on laravel Elixir on windows

I was trying to run the gulp command in the windows command promptafter installing node_modules in my laravel installation but it came back with this error in my windows command prompt :-
'gulp' is not recognized as an internal or external command,
operable program or batch file.
I was trying to use Lavarel Elixir and as in the Laracast videos I was trying to get the gulp command working on my command prompt but it shows
I installed node_modules using the below command
npm install --no-bin-links
it installed all the files
I am using Netbeans as my IDE and it is showing an error in the node_modules folder also , so I am unsure as to how to get this fixed and Working
My Work Environment is
Apache through MAMP
OS :- Windows 10
IDE :- Netbeans
Thanking you in anticipation
In order to be able to run gulp you need to install the gulp command line interface globally like so: npm install -g gulp-cli. Afterwards you need to add a gulpfile.js where you would configure your builds/tasks. For more information check out the official "Getting started" guide and the docs on gulp: https://github.com/gulpjs/gulp/blob/master/docs/getting-started.md

Jenkins not recognizing composer command

I have a local install of JenkinsCI. Installed via instructions in the Chapter 2 of Jenkins The Definitive Guide. I start Jenkins via Java Web Start/JNLP file on my MAC running El Capitan. All that went great, sample project is working.
I know want to get my Codeception Acceptance test running via Jenkins. I'm following the most recent blog post about this on the Codeception site: http://codeception.com/02-04-2015/setting-up-jenkins-with-codeception.html#.VwWxE2PLRAZ.
Using the Execute shell build step, my build fails with the following message:
Started by user anonymous
Building in workspace /Users/Cosette/.jenkins/workspace/Project Name
[Project Name] $ /bin/sh -xe
/var/folders/ns/ly6hv_513tl6qqslrb2vj_dw0000gn/T/hudson9210778078639547082.sh
composer install
/var/folders/ns/ly6hv_513tl6qqslrb2vj_dw0000gn/T/hudson9210778078639547082.sh:
line 2: composer: command not found
Build step 'Execute shell' marked build as failure
Finished: FAILURE
My guess is that maybe this install type doesn't install the Jenkins user? Please note I am very beginner level and this is my first question here on stackoverflow. Also, That should be a + sign in front of "composer install".
You should download composer from https://getcomposer.org/, rename it to composer, make executable with chmod +x and place somewhere in the PATH of Jenkins.
I have yet to find an answer to ensuring the Jenkins user has access to files under other users. I eventually gave up and installed via homebrew, eliminating the Jenkins user all together. For now I'm just placing everything necessary to run in Users/UserName/.jenkins/Home/workspace/Project-name

Laravel 5/Composer terminal error: sh.exe": composer: command not found

I get the error in the title when I try to run composer require "illuminate/html":"5.0.*" in my terminal (Git Bash) under my current project file path. Even if I type something like composer -v I get the same error.
I've even tried reinstalling composer and it installs fine but the commands still don't work.
In the PhpSTORM terminal, running the same commands gives this error: 'composer' is not recognized as an internal or external command, operable program or bath file.
I have VirtualBox, Vagrant and Laravel all installed correctly with Composer (I know it's all good because my code is great and works fine when trying it live and what not)... unless I'm missing something here (Laravel noob).
Why is this happening?
If you installed composer outside your virtual box (in your host system) and you want to use it without ssh into your vagrant box:
Make sure you add composers directory to your PATH. Then close your current terminal and reload a new one. Closing the terminal is necessary to reload the PATH.
The error sh.exe": composer: command not found indicates that the composer is not found in the current folder or the PATH.
Found out why I was getting the error: forgot to ssh.
The fix was this: vagrant ssh in the terminal.

Categories