How install Vue JS + TailwindCss in Laravel 8.29.0 - node.js

started installing plugins to my Laravel project.
Laravel new public
npm install
composer require laravel / ui
php artisan ui vue
npm install -D tailwindcss # latest postcss # latest autoprefixer # latest
npx tailwindcss init
add line in tailwind.config.js purge: [ './resources//*.blade.php', './resources//.js',
'./resources/**/.vue', ],
add line in webpack.mix.js require ("tailwindcss"),
Add im resource / css / app.css 3-line #tailwind base; #tailwind components; #tailwind utilities;
add link stylesheet in main template file (main.blade.php) {{asset ('css / app.css')}}
After all the monipulations mentioned above, I execute the command npm install && npm run dev, and I get an error
> npm run development
> # development D:\laravel\public
> mix
× Mix
Compiled with some errors in 6.30s
ERROR in ./resources/js/components/ExampleComponent.vue 1:0
Module parse failed: Unexpected token (1:0)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
> <template>
| <div>
| <h3>Hey</h3>
webpack compiled with 1 error
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! # development: `mix`
npm ERR! Exit status 1
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\****\AppData\Roaming\npm-cache\_logs\2021-02-26T09_06_38_033Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! # dev: `npm run development`
npm ERR! Exit status 1
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\***\AppData\Roaming\npm-cache\_logs\2021-02-26T09_06_38_066Z-debug.log

Would you try these two solutions
1 - Run MacOS Or Windows super user
1.1 MacOS sudo npm run development
1.2 Windows right click terminal open with Administrator
2- Cleen code to

Related

Nestjs failed to deploy on cpanel

I'm trying to deploy my backend application on cpanel and I'm getting an error like this
what should i do to solve this problem?
> test3#0.0.1 start /home/nandaken/inventory
> nest start
stderr:
npm WARN lifecycle The node binary used for scripts is /home/nandaken/nodevenv/inventory/12/bin/node but npm is using /opt/alt/alt-nodejs12/root/usr/bin/node itself. Use the `--scripts-prepend-node-path` option to include the path for the node binary npm was executed with.
sh: nest: command not found
npm ERR! code ELIFECYCLE
npm ERR! syscall spawn
npm ERR! file sh
npm ERR! errno ENOENT
npm ERR! test3#0.0.1 start: `nest start`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the test3#0.0.1 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! /home/nandaken/.npm/_logs/2023-01-28T08_16_43_494Z-debug.log
Looks like cpanel is calling the startscript which is running nest start. More than likely, you only have production dependencies installed, so #nestjs/cli isn't installed because it is a devDependency. Either configure cpanel to call a different start script (like start:prod which should map to node dist/main) or change your start script to run the proper js file (like node dist/main). The other option would be to install #nestjs/cli as a production dependency, but I wouldn't suggest that

Gitlab build fails when I use <%- ejs tag

This is the log I'm getting on the pipeline, my team was using the <%= tag on an ejs file, and I had to make a change to use <%- and then the build does not works on gitlab ci, but when I try to build locally, it works. And I'm not using this "underscore" library mentioned in the error.
"build:prod": "cross-env NODE_ENV=production webpack"
This is the script to run the build
ERROR in ./views/forms/survey.ejs
Module not found: Error: Can't resolve 'underscore' in '/builds/ve/vsplatform/vsmanager/views/forms'
# ./views/forms/survey.ejs 1:0-21
# ./controllers/forms/surveyForm_controller.js
# ./initialization.js
# ./vsmanager.js
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! VSHOW_HTML_PLATFORM#1.0.0 build:prod: cross-env NODE_ENV=production webpack
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the VSHOW_HTML_PLATFORM#1.0.0 build:prod 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! /root/.npm/_logs/2022-08-25T16_22_43_830Z-debug.log
I figured it out, the problem is that I haven't installed underscore on the project, but I'm still trying to understand why it was working locally.

NPM run dev error after requiring Tailwind CSS

I'm just dipping my toes into using Laravel for the first time, and I've had many issues so far. I've figured them out myself so far, but this one is driving me crazy!
After adding the line require('tailwindcss') in my webpack.mix.js file, I keep getting the following error when I run.
npm run dev
✖ Mix
Compiled with some errors in 452.52ms
ERROR in ./resources/css/app.css
Module build failed (from ./node_modules/mini-css-extract-plugin/dist/loader.js):
ModuleBuildError: Module build failed (from ./node_modules/postcss-loader/dist/cjs.js):
TypeError: Cannot read property &apos;config&apos; of undefined
at getTailwindConfig (/home/timothy/blog/node_modules/tailwindcss/lib/lib/setupTrackingContext.js:81:62)
at /home/timothy/blog/node_modules/tailwindcss/lib/lib/setupTrackingContext.js:124:92
at /home/timothy/blog/node_modules/tailwindcss/lib/processTailwindFeatures.js:41:11
at plugins (/home/timothy/blog/node_modules/tailwindcss/lib/index.js:20:104)
at LazyResult.runOnRoot (/home/timothy/blog/node_modules/postcss/lib/lazy-result.js:339:16)
at LazyResult.runAsync (/home/timothy/blog/node_modules/postcss/lib/lazy-result.js:393:26)
at LazyResult.async (/home/timothy/blog/node_modules/postcss/lib/lazy-result.js:221:30)
at LazyResult.then (/home/timothy/blog/node_modules/postcss/lib/lazy-result.js:206:17)
at processResult (/home/timothy/blog/node_modules/webpack/lib/NormalModule.js:751:19)
at /home/timothy/blog/node_modules/webpack/lib/NormalModule.js:853:5
at /home/timothy/blog/node_modules/loader-runner/lib/LoaderRunner.js:399:11
at /home/timothy/blog/node_modules/loader-runner/lib/LoaderRunner.js:251:18
at context.callback (/home/timothy/blog/node_modules/loader-runner/lib/LoaderRunner.js:124:13)
at Object.loader (/home/timothy/blog/node_modules/postcss-loader/dist/index.js:142:7)
1 ERROR in child compilations (Use &apos;stats.children: true&apos; resp. &apos;--stats-children&apos; for more details)
webpack compiled with 2 errors
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! # development: `mix`
npm ERR! Exit status 1
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! /home/timothy/.npm/_logs/2022-01-18T04_24_37_451Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! # dev: `npm run development`
npm ERR! Exit status 1
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! /home/timothy/.npm/_logs/2022-01-18T04_24_37_460Z-debug.log
I've looked into my version of Node.js and PostCSS being an issue, as my version of node.js has been an issue that caused other problems I've had so far, but those two seem fine. If it matters, this is a Laravel project created with Composer on Ubuntu 20.04 with Laravel installer 4.2.9.
Just run this comman. Tailwind config file is missing.
npm install -D tailwindcss postcss autoprefixer
npx tailwindcss init

laravel 8 instalation error - npm run dev throws error

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

Parcel command not found

In my project, I use Parcel to bundle everything. Now, I am at the point where I need to deploy my app.
I clone my git repo with my React app and I put in the Node server.
I tried every command possible to install parcel, but I always get the following error :
> pp-react#0.1.0 build /home/volodymk/react
> parcel build index.html
sh: parcel: command not found
npm ERR! code ELIFECYCLE
npm ERR! syscall spawn
npm ERR! file sh
npm ERR! errno ENOENT
npm ERR! pp-react#0.1.0 build: `parcel build index.html`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the pp-react#0.1.0 build 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! /home/volodymk/.npm/_logs/2020-01-12T19_26_22_634Z-debug.log
How can I fix this ?
To run any installed node package (not just Parcel), use npx, the utility command shipped with npm. It executes packages that come with a runtime command in your node_modules/packagename/.bin directories.
As in npx parcel build index.html
More information available in the npx readme.

Resources