Can't find solution for 'npm run dev' error - php

I just installed fresh laravel project and wanted to use laravel-mix. I writed command 'npm install'; 'npm install cross-env', but then when I write command 'npm run dev', it shows errors.
I was looking for solution on internet, but nothing works for me.
Already did 'npm cache clean --force', 'npm install --global cross-env'. This is my first day when trying something with npm.
npm version: 6.4.1
node version: v10.14.2
os: windows 10
This what shows up in command line: https://pastebin.com/ChuEstZS
These ar log files: https://pastebin.com/AxijkMEr https://pastebin.com/14PJxgpD
Thank you!

This is how I solved the problem on my side. I reset all node files.
rm package.json
rm package-lock.json
rm -rf node_modules
npm cache clear --force
After that run npm install again. Everything should be fine now.
Or you can remove the above files manually from the explorer. Because the above commnads are for Linux or gi bash

Solution for my problem was npm install -g yarn.

Related

Symfony 6 AWS Beanstalk run npm run build

I'm new to AWS and I've gotten as far as getting the following error in Symfony:
Asset manifest file "/var/app/current/public/build/manifest.json" does not exist.
In local, this would be fixed by running npm run build. I've tried adding NPM_CONFIG_PRODUCTION=true in the environment variables, but I think that might just be for node.js apps?
I've also tried SSHing onto the EC2 instance and installing node on there, but I ran into errors trying to install either npm or nvm. I feel like this is the wrong approach anyway, since it seems like the idea of beanstalk is that you shouldn't need to ssh onto the instance.
Perhaps I should just include the node_modules folder in the zip uploaded, but since one of the recommended ways to produce the zip is to use git, this doesn't seem correct either.
After a lot of digging around, it seems like there's 3 options here:
SSH onto the instance(s) and the following worked for me (Amazon Linux 2 - ARM chip)
curl --silent --location https://rpm.nodesource.com/setup_16.x | sudo bash -
sudo yum -y install nodejs
(cd /var/app/current/;sudo npm add --dev #symfony/webpack-encore)
(cd /var/app/current/;sudo npm install)
(cd /var/app/current/;sudo npm run build)
The problem with this, is if you have multiple instances that scale up and down with a load balancer, it isn't really practical to do this.
Add the above as a hook:
The following sh file could be put in the following directory: .platform/hooks/predeploy
#!/bin/bash
curl --silent --location https://rpm.nodesource.com/setup_16.x | sudo bash -
sudo yum -y install nodejs
(cd /var/app/current/;sudo npm add --dev #symfony/webpack-encore)
(cd /var/app/current/;sudo npm install)
(cd /var/app/current/;sudo npm run build)
However, I've since learnt that it's best advised to just include the node_modules in the zip that gets uploaded. I guess this way the time to get the server up is reduced.
Include the node_modules folder in the zip that gets uploaded.
To include the node_modules folder, since this is naturally ignored by GIT, I used the EB CLI and added a .ebignore file, which is a clone of the .gitignore file, but includes the node_modules and public folders. Also be cautious in your build process that you're not including the node dev dependencies.

Laravel-9: Vite manifest not found at: \public\/build/manifest.json

Hello i just installed laravel breeze and tried to run it but it showed ma this error:
Vite manifest not found at: ...\public\/build/manifest.json
by searching this error i tried different answers but all in vain like:
npm run build, npm run serve
it gives this error
Missing script: "build"
npm ERR!
npm ERR! To see a list of scripts, run:
npm ERR! npm run
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\umar\AppData\Local\npm-cache\_logs\2022-07-17T08_18_43_641Z-debug.log
Vite manifest not found at: C:\xampp\htdocs\eBook\public\build/manifest.json
if you found this kind of error insted of php artisan serve use npm run dev
the try into ur browser as other time
I was having the same issue. For me it was a npm version problem. I updated it, Ubuntu and repeated the whole process again, and it worked.
try updating your nodejs to the latest version (18.6).
In the current version of laravel like 9.19 or above we have to start the "npm run dev" and at new terminal run the serve command "php arisan serve" than it will works fine

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.

Not able to run `npm install && npm run dev in Laravel 7 to use Bootstrap

I'm using Laravel 7 on my windows 10 machine. While try to use Bootstrap, after executed the command php artisan ui bootstrap, i got the blow message.
Bootstrap scaffolding installed successfully.
Please run "npm install && npm run dev" to compile your fresh scaffolding.
When run npm install && npm run dev, i got the error:
The token && is not a valid separator in this version.
What should I do now? I've already installed node.js and even enabled the path in environment variable.
Appreciate if someone could help on this!
Because you are using Powershell. Three alternatives you have:
Try to use CMD or Gitbash.
you can use try this command:
(npm run build) -and (node ./dist/main.js)
Run them separetly. npm install and npm run dev

custom script on docker run

I am trying to install the skeleton application of Zend Framework 3 with Docker.
The installation works fine, but I'm not able to run some composer scripts. In the composer.json there are some custom composer scripts, which should be generally launched with
composer cs-fix
I would like to lauch there commands with the Composer Docker image, using
docker run --rm -ti --volume $PWD:/app composer cs-fix
When I try to do this, I obtain the following error
/docker-entrypoint.sh: line 60: exec: cs-fix: not found
Is my command wrong?
Found it! Instead of trying to run the custom composer script, I need to use the special run-script command, as in
docker run --rm -it --volume $PWD:/app composer run-script "cf-fix"

Categories