I have a fresh install of Laravel 5.4. I as well have the folowing versions installed on my Windows PC
node: 6.11.0
npm:5.0.3
I have already run npm install, however, when i run npm run watch, i get the following error
> # watch C:\xampp\htdocs\tu
> cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --watch --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js
10% building modules 1/1 modules 0 active
Webpack is watching the files…
95% emitting
ERROR Failed to compile with 2 errors 12:12:42 AM
These dependencies were not found:
* C:\xampp\htdocs\tu\resources\assets\js\app.js in multi ./resources/assets/js/app.js ./resources/assets/sass/app.scss
* C:\xampp\htdocs\tu\resources\assets\sass\app.scss in multi ./resources/assets/js/app.js ./resources/assets/sass/app.scss
To install them, you can run: npm install --save C:\xampp\htdocs\tu\resources\assets\js\app.js C:\xampp\htdocs\tu\resources\assets\sass\app.scss
I've searched the internet but cant seem to get it working. Any help is appreciated.
I was having the exact same issue but Leo_Kelmendi's solution didn't work for me.
Searching on GitHub, I found there is a bug in NPM 5.2.0 that affects Laravel Mix. Read more about it here.
I had to revert NPM to its previous version in order to get my assets compiling again:
$ sudo npm install -g npm#5.1.0
Then, I removed all installed modules:
$ rm -rf node_modules/
$ npm cache clear --force
$ rm -rf package-lock.json
Notice that clearing the cache may take a while.
And, finally, I reinstalled node deps and run the dev script:
$ npm install
$ npm run dev
Try to revert to this package.json. You can find it here:
https://github.com/laravel/laravel/blob/c1643bf0c59b6864fc55e09cce3bfafc67d29e2a/package.json
And try to run it again, also make sure, there's a node_modules/moment folder.
Related
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!
Using npm run dev results in the error:
Invalid configuration object. Webpack has been initialized using a configuration object that does not match the API schema. configuration.module.rules[10] has an unknown property 'loaders'
Jetstream Version: 1.6
Jetstream Stack: Livewire
Laravel Version: 8.14
PHP Version: 7.3.0
Database Driver & Version: MySQL v8.0
Steps to reproduce:
Navigate to directory hosting Laravel 8 project
Run command rm -rf node_modules and wait for the command to complete
Run command rm package-lock.json
Run command npm cache clear --force
Run command sudo npm install --global npm - this updates NPM (Node Package Manager)
Run command sudo yarnpkg install
Run command sudo yarnpkg add babel#latest
Run command sudo yarnpkg add webpack#latest
Run command sudo yarnpkg add webpack-cli#latest
Run command sudo yarnpkg add vue-template-compiler --save-dev --production=false
Run command sudo yarnpkg add sass-loader#8.* sass --save-dev --production=false
Run command sudo npm install --global cross-env
Run command yarnpkg run dev
NPM is supposed to return a success message, but clearly something is either broken or misconfigured...
Problem has been solved through either an NPM or Yarn update
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
New to React Native I've made sure to install node.js from here and after install I'm told:
Node.js v9.5.0 to /usr/local/bin/node
npm v5.6.0 to /usr/local/bin/npm
I can verify the node version:
node --version: v9.5.0
I ran the documentation's getting started for npm install:
npm install -g create-react-native-app
and also referenced building projects and installed watchman with brew:
watchman 4.9.0
in the terminal ran: npm install -g react-native-cli and terminal: npm start and I get:
grim ~/react-native/react-native npm start
> react-native#1000.0.0 start /Users/grim/React-Native/react-native
> /usr/bin/env bash -c './scripts/packager.sh "$#" || true' --
module.js:557
throw err;
^
Error: Cannot find module 'graceful-fs'
at Function.Module._resolveFilename (module.js:555:15)
at Function.Module._load (module.js:482:25)
at Module.require (module.js:604:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/Users/grim/React-Native/react-native/local-cli/cli.js:12:1)
at Module._compile (module.js:660:30)
at Object.Module._extensions..js (module.js:671:10)
at Module.load (module.js:573:32)
at tryModuleLoad (module.js:513:12)
at Function.Module._load (module.js:505:3)
grim ~/react-native/react-native
After research I found NPM, cannot find 'graceful-fs', no matter what I do and in terminal ran:
sudo npm install -g graceful-fs
and get:
+ graceful-fs#4.1.11
added 1 package in 0.678s
but when I run npm install I get:
npm ERR! code EUNSUPPORTEDPROTOCOL
npm ERR! Unsupported URL Type "npm:": npm:babylon#^7.0.0-beta
npm WARN deprecated gulp-util#3.0.8: gulp-util is deprecated - replace it, following the guidelines at https://medium.com/gulpjs/gulp-util-ca3b1f9f9ac5
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/grim/.npm/_logs/2018-02-08T17_08_50_619Z-debug.log
and in the file log it shows:
116 error code EUNSUPPORTEDPROTOCOL
117 error Unsupported URL Type "npm:": npm:babylon#^7.0.0-beta
so I went to The Problem with gulp-util but when I do:
npm ls gulp-util
I get └── (empty).
Further research I found Why is my npm install not working? but that throws an npm ERR! What am I doing wrong and how can I get npm successfully installed on my Mac running Seirra?
What caused this was trying to test RNTester from the react native repo and it told me:
git clone https://github.com/facebook/react-native.git
cd react-native
npm install
Edit
Per the suggested answer already tried brew install node and was told with a warning node 9.5.0 is already installed so tried brew link node then prompted:
grim ~/react-native/react-native brew link node
Linking /usr/local/Cellar/node/9.5.0...
Error: Could not symlink bin/node
Target /usr/local/bin/node
already exists. You may want to remove it:
rm '/usr/local/bin/node'
To force the link and overwrite all conflicting files:
brew link --overwrite node
To list all files that would be deleted:
brew link --overwrite --dry-run node
so ran brew link --overwrite node.
Edit
Browsing through my files under Users/grim I found a directory with modules in it named node_modules could that be in the wrong location?
Edit
After further research I found Fixing npm On Mac OS X for Homebrew Users and ran:
rm -rf /usr/local/lib/node_modules
brew uninstall node
brew install node --without-npm
echo prefix=~/.npm-packages >> ~/.npmrc
curl -L https://www.npmjs.com/install.sh | sh
modified my ~/.bash_profile with nano:
export PATH="$HOME/.npm-packages/bin:$PATH"
ran npm install and received a missing package.json file so in the terminal did npm init and answered the questions. Went back and pointed to the cloned repo and when I run npm install:
npm ERR! code EUNSUPPORTEDPROTOCOL
npm ERR! Unsupported URL Type "npm:": npm:babylon#^7.0.0-beta
npm WARN deprecated gulp-util#3.0.8: gulp-util is deprecated - replace it, following the guidelines at https://medium.com/gulpjs/gulp-util-ca3b1f9f9ac5
but if I build a new project with react-native init AwesomeProject and npm install I get:
up to date in 0.416s
and I can point into the project and do react-native run-ios and it works but react-native run-android has to be tweaked in the build.bundle from: classpath 'com.android.tools.build:gradle:2.2.3' to classpath "com.android.tools.build:gradle:2.1.0"
Use Homebrew for Mac as package manager;
https://brew.sh/
then you can run: brew install node
There are many other utilities on this.
create-react-native app does not work with npm 5.
I had the same problem on Windows and downgraded my npm to 4 you can use npm i -g npm#4 to downgrade.
You may try to use yarn command with -W flag (or --ignore-workspace-root-check) which might be helpful.
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.
Regards
I'm using npm install cmd in my TFS build. I always get the following WARN:
npm WARN optional dep failed, continuing fsevents#0.3.1
How could I delete this warning?
Are you running on Windows or Linux? If so, fsevents cannot be installed, as it is an OSX-only package.
If you run npm with --loglevel=error, you should no longer see this or any other warnings. As far as I know, there is no way to selectively suppress warnings in npm.
The flag -s / --silent works great if you want to remove all warnings and errors:
npm install --silent
npm docs
npm install --no-optional prevents this warning