running grunt --force on moodle installation on local server

292 Views Asked by At

I tried to run grant to rebuild amd but instate I ruined everything, all min.js and min.js.map are totally wrong and not working, how could I uninstall all node.js and grunt and re-install a versions that is compatible with moodle 4.2 to run grunt again to rebuilt these files with steps please because I didn't do that before.

I got this error:

PS D:\server\htdocs\moodle> npm audit fix

npm ERR! code ERESOLVE

npm ERR! ERESOLVE unable to resolve dependency tree

npm ERR! 

npm ERR! While resolving: Moodle@undefined

npm ERR! Found: [email protected]

npm ERR! node_modules/grunt

npm ERR!   dev grunt@"^1.6.1" from the root project

npm ERR! 

npm ERR! Could not resolve dependency:

npm ERR! peer grunt@"0.4.x" from [email protected]

npm ERR! node_modules/grunt-jsdoc

npm ERR!   dev grunt-jsdoc@"^0.4.0" from the root project

npm ERR! 

npm ERR! Fix the upstream dependency conflict, or retry

npm ERR! this command with --force, or --legacy-peer-deps

npm ERR! to accept an incorrect (and potentially broken) dependency resolution.

npm ERR! 

npm ERR! See C:\Users\Pharouk-lenovo\AppData\Local\npm-cache\eresolve-report.txt for a full report.    
1

There are 1 best solutions below

0
Lin Du On
$ npm view [email protected] peerDependencies
{ grunt: '0.4.x' }

[email protected] has a peer dependency grunt and demands its version is 0.4.x. But in your project, the installed grunt package's version is 1.6.1 which is incompatible. The warning will display when using npm v7.

The safe solution is to fix the version compatibility issue. You can use the latest version of grunt-jsdoc(2.4.1 until 2023.7.4)

$ npm i grunt-jsdoc -D

The warning will be gone.

Further reading legacy-peer-deps

Use of legacy-peer-deps is not recommended, as it will not enforce the peerDependencies contract that meta-dependencies may rely on.