Failed at the # production script. Error running npm run production - laravel

I am facing issue while using the following command
npm run production
after execute following command i see following error
ERROR Failed to compile with 5 errors
error in ./resources/assets/sass/app.scss
Module build failed: ModuleBuildError: Module build failed: TypeError: Cannot read property 'map' of undefined
at preparePluginsArray (E:\wamp\www\smm.yasmalik.com\node_modules\svgo\lib\svgo\config.js:64:20)
at module.exports (E:\wamp\www\smm.yasmalik.com\node_modules\svgo\lib\svgo\config.js:32:28)
at new module.exports (E:\wamp\www\smm.yasmalik.com\node_modules\svgo\lib\svgo.js:21:19)
at E:\wamp\www\smm.yasmalik.com\node_modules\postcss-svgo\dist\index.js:95:16
at Object.creator [as postcssSvgo] (E:\wamp\www\smm.yasmalik.com\node_modules\postcss-svgo\node_modules\postcss\lib\postcss.js:150:35)
at E:\wamp\www\smm.yasmalik.com\node_modules\cssnano\dist\index.js:295:40
at Array.forEach (<anonymous>)
at E:\wamp\www\smm.yasmalik.com\node_modules\cssnano\dist\index.js:282:29
at creator (E:\wamp\www\smm.yasmalik.com\node_modules\cssnano\node_modules\postcss\lib\postcss.js:150:35)
at processCss (E:\wamp\www\smm.yasmalik.com\node_modules\css-loader\lib\processCss.js:199:16)

It was issue with my node_modules folder. there were some extra useless packages so simply i just deleted node_modules and install it again with following commands
Step 1
Delete node_modules manually
Step 2
Install the node_modules folder again:
npm i
Step 3
Update existing packages
npm update
That's it!

Probably you have some conflicts with versions of some npm packages.
Try to reinstall npm:
rm -rf node_modules
npm install

Related

1 WARNING in child compilations (Use 'stats.children: true' resp. '--stats-children' for more details)

How can I solve this warning when creating laravel project?
1 WARNING in child compilations (Use 'stats.children: true' resp. '--stats-children' for more details)
Steps to replicate:
composer create-project --prefer-dist laravel/laravel example
cd example
composer require laravel/ui
php artisan ui vue --auth
npm install vue#next vue-router#next vue-loader#next
npm install
npm run dev
EDIT
From this solution, add these lines to webpack.mix.js
mix.webpackConfig({
stats: {
children: true,
},
});
The above solution creates another warning:
WARNING in ./resources/sass/app.scss (./node_modules/css-loader/dist/cjs.js??clonedRuleSet-6.use1!./node_modules/postcss-loader/dist/cjs.js??clonedRuleSet-6.use[2]!./node_modules/resolve-url-loader/index.js??clonedRuleSet-6.use[3]!./node_modules/sass-loader/dist/cjs.js??clonedRuleSet-6.use[4]!./resources/sass/app.scss)
Module Warning (from ./node_modules/postcss-loader/dist/cjs.js):
Warning
(2423:3) autoprefixer: Replace color-adjust to print-color-adjust. The color-adjust shorthand is currently deprecated.
Child mini-css-extract-plugin C:\xampp\htdocs\lva\node_modules\css-loader\dist\cjs.js??clonedRuleSet-6.use1!C:\xampp\htdocs\lva\node_modules\postcss-loader\dist\cjs.js??clonedRuleSet-6.use[2]!C:\xampp\htdocs\lva\node_modules\resolve-url-loader\index.js??clonedRuleSet-6.use[3]!C:\xampp\htdocs\lva\node_modules\sass-loader\dist\cjs.js??clonedRuleSet-6.use[4]!C:\xampp\htdocs\lva\resources\sass\app.scss compiled with 1 warning
webpack compiled with 1 warning
How can I solve this?
The color-adjust shorthand is currently deprecated and it depends on the autoprefixer#10.4.6 (source).
I was able to fix this by reverting the autoprefixer package as well as #Benno to version 10.4.5. Run this:
npm install autoprefixer#10.4.5 --save-exact
You probably updated your npm packages. I was able to fix this by reverting the autoprefixer package to version 10.4.5 in the package-lock.json.
when you have problem with autoprefixer maybe because your version autoprefixer. you can add version autoprefixer based problem this version autoprefixer . i have problem on "print-color-adjust" and i add code on my package.json for change my autoprefixer become version "10.4.5"
when you use npm
"overrides": {
"autoprefixer": "10.4.5"
},
Or, when you use yarn
"resolutions": {
"autoprefixer": "10.4.5"
},
Don't forget to delete your package-lock and node_modules , then npm install again.
it work for me (react-bootstrap.v.5)
If you don't want to add additional packages to solve this error, then try this:
Capitalize all the files and Directory name in your components folder
Or you can run this command to install a package if the above solution doesn't work.
npm install autoprefixer#10.4.5 --save-exact
I'm using React with InertiaJS and Laravel as backend, this solution worked in my case.
Thanks
I have the same problem, whenever I hit save an annoying pop-up of error code comes. The simple solution is to add the following code to your webpack.mixjs file :
mix.webpackConfig({
stats: {
children: true,
},});
stop the npm run watch
add a package autoprefixer, add below in terminal:
npm install autoprefixer#10.4.5 --save-exact
run npm run watch and it will not give the error again.
I solved this issue within Laravel by changing the file ./node_modules/bootstrap/scss/forms/_form-check.scss
Line 28 part of the .form-check-input style
change color-adjust: exact; // Keep themed appearance for print
to print-color-adjust: exact; // Keep themed appearance for print

How can I solve the problem with module 'os' and 'fs' using npm in Laravel 8?

Suddenly I received the following error:
app.js:28823 Uncaught Error: Cannot find module 'os'
at webpackMissingModule (app.js:28823)
at Object../node_modules/laravel-mix/src/File.js (app.js:28823)
at __webpack_require__ (app.js:79613)
at Object../resources/js/app.js (app.js:6700)
at __webpack_require__ (app.js:79613)
at app.js:79751
at Function.__webpack_require__.O (app.js:79650)
at app.js:79753
at app.js:79755
I tried deleting the node_module folder and the package-lock.json file, and run npm install, to no avail.
When I launch npm run dev I get the following error:
Error: Can't resolve 'os' in 'C:\...\node_modules\clean-css\lib\options'" -t "Laravel Mix"
UPDATE: I run npm install --save os and this problem was solved. But another one arose! Error: Can't resolve 'fs' and this one doesn't resolve with npm install --save fs
NPM version: 7.18.1
SOLVED: I don't know how in the top of resources\js\app.js file appeared this line:
const { exists } = require("laravel-mix/src/File");
I just deleted it and npm run dev didn't give any more errors.
I hope this answer will help someone else.
This all happens when you auto-import the modules using any extension.
Solution:
delete the package-lock.json file and run:
npm i
it works for me.
Another solution is to remove the
import { exists } from 'laravel-mix/src/File'
from the react component first line and it works.

NPM broken TypeError: Cannot read property 'loaded' of undefined

NPM has been installed by the Azure DevOps agent install on my mac os Mojave v10.14.6. I can access the npm but any commadn gives tha same error. this is the only command that work
sudo npm --version =6.12.0
sudo npm -p process.platform = darwin
this is the same error message I get for any other command:
Error: EISDIR: illegal operation on a directory, read TypeError:
Cannot read property 'loaded' of undefined
at exit (/usr/local/lib/node_modules/npm/lib/utils/error-handler.js:97:27)
at errorHandler (/usr/local/lib/node_modules/npm/lib/utils/error-handler.js:216:3)
at /usr/local/lib/node_modules/npm/bin/npm-cli.js:78:20
at cb (/usr/local/lib/node_modules/npm/lib/npm.js:225:22)
at /usr/local/lib/node_modules/npm/lib/npm.js:263:24
at /usr/local/lib/node_modules/npm/lib/config/core.js:81:7
at Array.forEach ()
at /usr/local/lib/node_modules/npm/lib/config/core.js:80:13
at f (/usr/local/lib/node_modules/npm/node_modules/once/once.js:25:25)
at finalize (/usr/local/lib/node_modules/npm/lib/config/core.js:187:14)
/usr/local/lib/node_modules/npm/lib/utils/error-handler.js:97 var
doExit = npm.config.loaded ? npm.config.get('_exit') : true
I have downloaded the latest version node version from nodejs.org and this has not help.
I believe the problem is that it is missing the .npmrc but i might be wrong.
I ran locate command and here are all the results anything under deb/myagent is azure devops pulled source for building the apps:
Mac-mini:/ sedev$ locate .npmrc
/Applications/Xcode.app/Contents/Developer/usr/share/xcs/xcsd/node_modules/nsp/node_modules/npmconf/test/fixtures/.npmrc
/Applications/Xcode.app/Contents/Developer/usr/share/xcs/xcsd/node_modules/nsp/node_modules/silent-npm-registry-client/node_modules/npm-registry-client/node_modules/npmlog/.npmrc
/Users/sedev/.npmrc
/Users/sedev/myagent/_work/10/s/app.WebUi/wwwroot/bower_components/vaadin-checkbox/.npmrc
/Users/sedev/myagent/_work/10/s/app.WebUi/wwwroot/bower_components/vaadin-control-state-mixin/.npmrc
/Users/sedev/myagent/_work/10/s/app.WebUi/wwwroot/bower_components/vaadin-element-mixin/.npmrc
/Users/sedev/myagent/_work/10/s/app.WebUi/wwwroot/bower_components/vaadin-grid/.npmrc
/Users/sedev/myagent/_work/10/s/app.WebUi/wwwroot/bower_components/vaadin-grid-5.0.0-alpha6/.npmrc
/Users/sedev/myagent/_work/10/s/app.WebUi/wwwroot/bower_components/vaadin-icons/.npmrc
/Users/sedev/myagent/_work/10/s/app.WebUi/wwwroot/bower_components/vaadin-text-field/.npmrc
/Users/sedev/myagent/_work/10/s/app.WebUi/wwwroot/bower_components/vaadin-themable-mixin/.npmrc
Mac-mini:/ sedev$
The answer was the .npmrc was corrupt or something. I had to remove it and it worked
sudo rm /Users/sedev/.npmrc
It Is Possible someTime That Node has crashed.
so solution Is That Uninstall NodeJs and Install it Againg
Install for [ 'browserslist#latest' ] => npm i browserslist#latest

Laravel error when running npm run dev command

When I run npm run dev in the terminal I get the following message:
ERROR in ./resources/js/components/ExampleComponent.vue
Module build failed (from ./node_modules/vue-loader/lib/index.js):
Error: [vue-loader] vue-template-compiler must be installed as a peer dependency, or a compatible compiler implementation must be passed via options.
at loadTemplateCompiler (/portal/node_modules/vue-loader/lib/index.js:21:11)
at Object.module.exports (
(/portal/node_modules/vue-loader/lib/index.js:65:35)
# ./resources/js/app.js 19:35-79
# multi ./resources/js/app.js ./resources/sass/app.scss
Can anyone tell me what this error means and how do I fix it?
I tried to run this command in the terminal, but I am still getting the error.
The command: npm i -D vue-template-compiler
I have also tried to reinstall all of my dependencies, but that didnt work either.

Your JET project does not have oraclejet-tooling installed

I recently installed Oracle jet and I haven't made any changes to it. I created my first project today and it's showing error when I try to build it or serve it. I am trying to run it on Visual Studio (I don't this matters tho)
This is the error I am getting
PM> ojet serve ojet : [31mError: Your JET project does not have oraclejet-tooling installed.[0m
At line:1 char:
+ ojet serve
+ ~~~~~~~~~~
+ CategoryInfo : NotSpecified: ([31mError: You... installed.[0m:String) [], RemoteException
+ FullyQualifiedErrorId : NativeCommandError
UPDATE: Apparently when I create a new template it is creating an error from there itself the app structure is generated but during invoking mom install it is unable to parse through some certain JSON
Following is the Error:
ojet create ojetnavbar --template=navbar
Processing template: navbar
Your app structure is generated. Continuing with library install.
Performing npm install may take a bit.
Invoking npm install.
npm WARN deprecated coffee-script#1.12.7: CoffeeScript on NPM has moved to "coffeescript" (no hyphen)
npm ERR! Unexpected end of JSON input while parsing near '...oIzTWjIvO8rspcLCK+1pI'
npm ERR! A complete log of this run can be found in:
npm ERR! *location of log*
Error: (during Invoking npm install.) 1
$ npm install -g #oracle/ojet-cli
$ npm install -g #oracle/oraclejet-tooling
$ ojet restore
This will solve your problem
I have sorted out on the issue it was because the JSON npm was trying to parse were mostly cached and due to that a parsing error was occurring
I used npm-cache clean on my PC and all of it ran after that perfectly fine.
I think you need to add oraclejet tooling to your project. Try this:
cd appDir
npm install #oracle/oraclejet-tooling --save
oraclejet-tooling package has been deprecated, you have to use module contains a command-line interface for Oracle JET web and hybrid mobile application development.
See https://www.npmjs.com/package/#oracle/ojet-cli
cd oracle-jet-simple-web
npm install #oracle/ojet-cli --save
For me this helped
npm i #oracle/oraclejet-tooling
Here is the link: npmjs.com/package/#oracle/oraclejet-tooling

Resources