laravel 8 instalation error - npm run dev throws error - node.js

I am trying to install a fresh laravel 8 project. After downloading frontend scaffolding when I try to run npm run dev it gives me an error. This problem also happens during installing jetstream in this npm run dev. I am giving error below.
unkno#DESKTOP-NAP4DRR MINGW64 /c/laravel projects/example
$ npm run dev
> # dev C:\laravel projects\example
> npm run development
> # development C:\laravel projects\example
> mix
[webpack-cli] Running multiple commands at the same time is not possible
[webpack-cli] Found commands: 'bundle', 'projects\example\node_modules\laravel-mix\setup\webpack.config.js'
[webpack-cli] Run 'webpack --help' to see available commands and options
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! # development: `mix`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the # development script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\unkno\AppData\Roaming\npm-cache\_logs\2021-01-09T03_39_54_620Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! # dev: `npm run development`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the # dev script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\unkno\AppData\Roaming\npm-cache\_logs\2021-01-09T03_39_54_704Z-debug.log

I experienced the same problem a few weeks ago. What I figured out was that on windows that instead of running the command npm install && npm run dev it needed to be npm install and npm run-dev.
Also make sure you have the latest node and npm versions install. Perform a npm audit fix as well to fix any vulnerabilities.

I can see you are a Windows developer, and that you have spaces in the name of your project folder. Windows, spaces and nodejs don't like to behave very nicely together.
Try removing the spaces from name of your project path and see if this addresses the issue for you.
Update: As per a similar question, Laravel, error when running npm run dev on fresh new installation, this solved the users issue.

Try doing a full reset:
rm -rf node_modules
rm package-lock.json yarn.lock
npm cache clear --force
npm install
It works for me, on Laravel 9
Thanks to Sir Jeffrey Way

Related

NextJS not running on MacOS even after installing modules

So I've just created a NextJS project using create-next-app which went smoothly as expected. Then ran npm i just to be sure and saw all modules installed into node_modules
When I try to run npm run dev to start my nextjs app. it just says
sh: next: command not found
npm ERR! code ELIFECYCLE
npm ERR! syscall spawn
npm ERR! file sh
npm ERR! errno ENOENT
npm ERR! test#0.1.0 dev: `next dev`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the test#0.1.0 dev script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/john.v.n.pakson/.npm/_logs/2022-10-06T08_01_29_725Z-debug.log
It seems like npm is not detecting the node_modules i have installed.
Not sure if this is a mac or a zsh issue.
I'm using node version 12.22.12
Upgraded to 16.17.1 and still see the same error
> test#0.1.0 dev
> next dev
/var/folders/6y/xtlzp4z16dj0stxnqx8znj8w0000gn/T/dev-01c08137.sh: line 1: next: command not found
Okay I figured it out. It was caused by my file path on macos. My project was on a folder called Project/Test which might have confused zsh or mac. This in turn caused npm to not be able to find the correct scripts on my node_modules
When I moved my project to another folder I was already able to run npm run dev properly.
Cheers!

having problem in running my npm start on my IDE terminal

i am having problem in running my node app. i am getting this error whenever i run npm start from my termineal.
please i need help.
requireStack: []
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! nasa-project-api#1.0.0 start: node src/server.js
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the nasa-project-api#1.0.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\USER\AppData\Roaming\npm-cache_logs\2022-09-15T09_15_58_848Z-debug.log
PS C:\Users\USER\Desktop\NASA-PROJECT\server>
Step 1: npm cache clean --force
Step 2: Delete node_modules by $ rm -rf node_modules package-lock.json folder or delete it manually by going into the directory and right-click > delete / move to trash. Also, delete package-lock.json file too.
Step 3: npm install
To start again, npm start
This worked for me. Hopes it works for you too.
PS: If it is still there, kindly check the error it is displaying in red and act accordingly. This error is specific to node.js environment.

npm install always gives 'Your cache folder contains root-owned files, due to a bug in npm previous versions of npm which has since been addressed.'

I am currently using Ubuntu 18.04.4 and I am trying to install something using npm install but it always gives the error below. I tried other aliases as well (npm i, npm add) but the error persists.
npm install
npm ERR! code EPERM
npm ERR! syscall open
npm ERR! path /home/dell/.npm/_cacache/content-v2/sha512/14/21/2143fe2b135cd8bfdad85c9c3f9ac46ab279a58dee631cfea1b9678167bd388d44f2d36739019c96ba3a4c4756b1ea6570f4dc8931fb8ad8230359521f80
npm ERR! errno -1
npm ERR!
npm ERR! Your cache folder contains root-owned files, due to a bug in
npm ERR! previous versions of npm which has since been addressed.
npm ERR!
npm ERR! To permanently fix this problem, please run:
npm ERR! sudo chown -R 1001:1001 "/home/dell/.npm"
npm ERR! A complete log of this run can be found in:
npm ERR! /home/dell/.npm/_logs/2020-07-30T17_16_58_257Z-debug.log
When I run the sudo chown -R 1001:1001 "/home/dell/.npm" command, it does nothing, and the error remains when I run npm install again. I have also searched StackOverflow and other platforms for the answer, but no solution seems to solve this problem.
P.S: My node version is 12.18.3 and npm version is 6.14.6.
If someone can help me resolve this, I would really appreciate it!
I had problem with create-react-app. Solve it using yarn.
yarn global remove create-react-app
then
yarn global add create-react-app
and
create-react-app MyApp

NPM on new Mac with transferred files from my previous linux system. Problem with npm start on VS CODE terminal

Hey people...transferred some working js files from old linux to my new macbook air. Upon trying to start my files with NPM start in the vs code terminal, I'm getting this error: (please help!)
Galias-MacBook-Air:react-nextagram Guy$ npm start
react-nextagram#0.1.0 start /Users/Guy/Desktop/Next Academy/react-nextagram
react-scripts start
sh: /Users/Guy/Desktop/Next Academy/react-nextagram/node_modules/.bin/react-scripts: cannot execute binary file
npm ERR! code ELIFECYCLE
npm ERR! errno 126
npm ERR! react-nextagram#0.1.0 start: `react-scripts start`
npm ERR! Exit status 126
npm ERR!
npm ERR! Failed at the react-nextagram#0.1.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/Guy/.npm/_logs/2019-01-24T01_15_13_056Z-debug.log
Galias-MacBook-Air:react-nextagram Guy$
Me too. I migrate from Ubuntu 18.04 to OSX Catalina. This is how I solve :
Delete your node_modules and npm install or npm install -s
Problem is inside your node_modules
The problem here is that you have compiled dependencies. One or more of the packages you use on your application need to be compiled against the OS you are going to run them in. To fix this, you can try one of the options bellow:
This will rebuild everything against your current OS.
npm rebuild
Or
you can do a clean install.
rm -rf node_modules && npm install

Cannot run "npm run watch", error message brings up "gulp" error

I am using a web starter kit from coding phase GitHub that normally works fine for me. for some reason when i attempt to run npm run watch it gives me error messages. I'm not 100% positive but I believe this begun when I updated my I did an uninstall and re-install of nodeJS. help me out!
sh: gulp: command not found
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! starter-kit-2019#1.1.0 watch: `gulp`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the starter-kit-2019#1.1.0 watch script.
npm ERR! This is probably not a problem with npm. There is likely
additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/joseperez/.npm/_logs/2018-12-20T02_45_19_840Z-
debug.log
Its because we are using 'gulp' as a global module. So when you removed node from your system, it removed the gulp which is a package installed.
You can reinstall it by using
`npm install gulp-cli -g`
And it will work!
Update:
He is using a mac so try running this command.
$ npm uninstall --global gulp gulp-cli
$ rm /usr/local/share/man/man1/gulp.1
$ npm install --global gulp-cli`
Hope this info turns out useful to someone after doing research on an error that was coming up on my console stating, "gulp: command not found" I found a link that addresses how to fix this. turns out my gulp was not installing properly because there was an issue with my path. btw I am using a Mac machine below is the link that helped me out!
here is the link that helped me out!

Resources