NPM run watch resulting in error Laravel 5.7 - laravel

I am receiving this error when I try to run npm run watch
Error: Cannot find module 'C:\wamp64\www\node_modules\laravel-mix\setup\webpack.config.js'
I am currently using
Laravel Framework 5.7.16
NPM 6.4.1
Thank you in advance
Edit: yes, I have run npm install

You have to first install your node modules with:
npm install

It seems that you don't have the package Laravel-mix, install it running:
npm install laravel-mix --save-dev
Also check if you have your webpack.config.js inside the main folder of your app, if not check for the docs on how to get it: https://laravel-mix.com/docs/3.0/installation

Related

Tailwind CSS Laravel Mix Error - Forces PostCSS 8 to be installed

I recently created a new laravel 8 project using Breeze for the authentication and tailwind css. All worked perfectly when running npm run watch but once I run npm run prod I ran into errors. I noticed that the Tailwind docs mention that there are PostCSS issues so you need to unistall and run
npm install tailwindcss#npm:#tailwindcss/postcss7-compat #tailwindcss/postcss7-compat postcss#^7 autoprefixer#^9
I done that however every time I run npm run prod now the build quits at 98% and says
Additional dependencies must be installed. This will only take a moment.
Running: npm install postcss#^8.1 --save-dev --legacy-peer-deps
npm WARN browser-sync-webpack-plugin#2.2.2 requires a peer of webpack#^1 || ^2 || ^3 || ^4 but none is installed. You must install peer dependencies yourself.
Finished. Please run Mix again.
This auto updates PostCSS to 8.1 every time.
After that if I run npm run prod again it does the exact same message over and over.
I've tried removing the browsersync plugins and trying again but it still doesn't work.
Anyone ran into this or got a solution?
laravel-mix v6 now supports PostCSS8
According to tailwind docs, it suggests to use npm install tailwindcss#npm:#tailwindcss/postcss7-compat #tailwindcss/postcss7-compat postcss#^7 autoprefixer#^9
With the new Mix v6, run npm install tailwindcss#latest postcss#latest autoprefixer#latest
After this, npm run prod will run the way it should.
you must upgrade laravel mix using the following command
npm install laravel-mix#latest
As Digvijay mentioned above the new Mix v6 now supports PostCSS 8. So run:
npm install tailwindcss#latest postcss#latest autoprefixer#latest
After the when you run npm run prod you will still get this message:
Additional dependencies must be installed. This will only take a moment.
Running: npm install browser-sync browser-sync-webpack-plugin#2.2.2 --save-dev --legacy-peer-deps
npm WARN browser-sync-webpack-plugin#2.2.2 requires a peer of webpack#^1 || ^2 || ^3 || ^4 but none is installed. You must install peer dependencies yourself.
Finished. Please run Mix again.
To fix this just add sudo to the front of the npm command it ran:
sudo npm install browser-sync browser-sync-webpack-plugin#2.2.2 --save-dev --legacy-peer-deps
Now run npm run prod and it should work!

Error executing "npm run" in fresh laravel file - Cannot find module npm-cli.js

Can someone help me on this? I'm getting error below when executing the npm run on my fresh laravel project.
I've installed new laravel file larave new vue-lar-proj
then installed modules npm install
then immediately tried to execute npm run watch I'm getting error below.
But when I tried installing the laravel file using this command
composer create-project --prefer-dist laravel/laravel vue-lar-proj "5.5.*"
I've got no problem executing the npm run watch.
I only get the error on npm run dev and npm run prod
I'm new on this, appreciate your help in advance.
I had this problem. I found out that node_modules folder did not exist. So I created this folder by:
$ npm install
I didn't install npm-cli globally. So tried to install npm-cli:
$ npm install npm-cli

Ionic / Cordova installation failure

Can you help me to resolve the problem with Ionic and Cordova shown in the screenshot below?
Update to latest npm and run as non-admin (if you were) and give it a try again.
npm install -g npm
or first try updating packages
npm update -g
Update npm to latest version and check again.
npm install -g npm
If problem persists then update the node also.
Then you are good to go.

Error: Cannot find module 'gulp-sass'

When I compile with gulp, I got an error like below. How can I fix it?
module.js:339
throw err;
^
Error: Cannot find module 'gulp-sass'
at Function.Module._resolveFilename (module.js:337:15)
at Function.Module._load (module.js:287:25)
at Module.require (module.js:366:17)
at require (module.js:385:17)
at Object.<anonymous> (/Applications/XAMPP/xamppfiles/htdocs/flyscoot.com/gulpfile.js:2:12)
at Module._compile (module.js:435:26)
at Object.Module._extensions..js (module.js:442:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:311:12)
at Module.require (module.js:366:17)
Just do npm update and then npm install gulp-sass --save-dev in your root folder, and then when you run you shouldn't have any issues.
Edit your package.json. Change:
"gulp-sass": "^2.3.2"
to
"gulp-sass": "3.0.0"
Delete the node_modules folder and run npm install again.
Source: https://github.com/codecombat/codecombat/issues/4430#issuecomment-348927771
Did you check this question?
May be possible solution is:
rm -rf node_modules/
npm install
I had the same problem, and I resolve doing this npm update. But I receive the message about permission, so I run:
sudo chwon -R myuser /home/myUserFolder/.config
This set permissions for my user run npm comands like administrator. Then I run this again:
npm update
and this:
npm install gulp-sass
Then my problem with this was solved.
Try this:
npm install -g gulp-sass
or
npm install --save gulp-sass
I had the same problem on my new Windows 10 machine. I had to intall the Windows build tools with npm install -g windows-build-tools. (https://github.com/Microsoft/nodejs-guidelines/blob/master/windows-environment.md#environment-setup-and-configuration)
i was also facing the same issue,
The possible solution is to install the gulp-sass module, but if you will run the below command npm install -g gulp-sass or npm install --save gulp-sass, This is not going to be updated on node-sass project's end.
This version of node-sass is missing (returns a 404) and google web-starter-kit v0.6.5 has depended on it for a long time, since Dec 2016. So, it has been working for a long time and must have just disappeared.
Downloading binary from
https://github.com/sass/node-sass/releases/download/v3.13.1/win32-x64-57_binding.node
Cannot download
"https://github.com/sass/node-sass/releases/download/v3.13.1/win32-x64-57_binding.node":
HTTP error 404 Not Found
The only workaround is to upgrade node-sass:
npm i gulp-sass#latest --save-dev to fix the issue.
I had same error on Ubuntu 18.04
Delete your node_modules folder and run
sudo npm install --unsafe-perm=true
Make sure python is installed on your machine, Python is required for node-sass.
I had this issue for days looking for answers. My error log was similar to this npm just won't install node sass
The only problem was the node version. Maybe it can help some of you.
I downgraded my Node.js from 9.3.0 to 6.12.2 and run:
npm update
In the root folder where package.json is located, run npm outdated. You'll get outdated packages returned with some details. In those details, you'll see the current version number of the outdated package.
After then, open the package.json file and manually change the version number of the corresponding package.
Then delete the node_modules folder and run npm install. It should solve this issue.
I ran : npm i gulp-sass#latest --save-dev
That did the magic for me
Ive faced the same troubles with gulp-sass in my VSCode environment.
Also, I was observing a lot of fails during npm installing and I could not start gulp (as outcome).
The way how I fixed it:
delete packages
npm i
npm i gulp-sass --save-dev
Now it works.
Those who are getting this error, please downgrade the Node.js you are using.
Step 1 :
Uninstall the one you are using and install the version you prefer. I installed v6.12.3. My previous Node.js version was v9.4.0.
Step 2 :
Download Node.js.
Hope this will work.
I worked with Yarn and I got the same issue and I solve it doing this:
delete node_modules
yarn install
yarn upgrade
yarn install gulp-sass --save-dev
Try this to fix the error:
Delete node_modules directory.
Run npm i gulp-sass#latest --save-dev
Solution:
const sass = require('gulp-sass')(require('sass'));
npm install gulp-sass sass

Command error running installed npm modules

Hi guys could you help me? i've installed the latest version of node.js and installed cordova and ionic framework the problem starts is when i'm trying to run the ionic command, the console throw me the following message:
MacBook-Pro-de-Diego:~ diegochavez$ ionic start myApp
-bash: ionic: command not found
So then i looked for the root of my npm modules
MacBook-Pro-de-Diego:~ diegochavez$ npm root
/Users/diegochavez/node_modules
if you guys know something to fix this? Thanks in advance
First check if ionic is installed at path like /usr/local/lib/node_modules/ionic/bin/ionic. If it is there, you need to check the npm default global path.
Run command npm config get prefix to check the default path, it should be /usr/local. If it is not /usr/local, run command npm config set prefix /usr/local to set it. And then install again. Also see this answer
I having issue while running - sudo npm install -g gulp ionic with below version of node installed
node -v v0.10.15
npm -v 1.3.5
Error went way after I update node to latest version v0.10.26
The error you are getting is because ionic was not installed successfully. Trying updating node and run command as mentioned sudo npm install -g gulp ionic
Check where your npm folder is located. If your npm folder is located in $Home..then type this:
export PATH="$HOME/npm/bin:$PATH"
You need to run sudo npm install -g ionic from the command line.

Resources