How can i fix the npm run build error in angular application while deploying the application with server in vscode?

Viewed 22

I am trying to build my application using npm run build --configuration production. But I am getting errors as below: I don't know how to fix it. I am new to using npm build commands. Kindly help me improve this.

 npm run build --configuration production
npm WARN config global `--global`, `--local` are deprecated. Use `--location=global` instead.
npm WARN npm npm does not support Node.js v16.16.0
npm WARN npm You should probably upgrade to a newer version of node as we
npm WARN npm can't make any promises that npm will work with this version.
npm WARN npm Supported releases of Node.js are the latest release of 6, 8, 9, 10, 11, 12.

> @coreui/lutosa-obs@0.0.1 build C:\Users\Administrator\OneDrive\Documents\OSB-Frontend-production\Lutosa_front-end
> ng build --prod --aot --build-optimizer --common-chunk --vendor-chunk --optimization --progress "production"

'find_dp0' is not recognized as an internal or external command,
operable program or batch file.
node:internal/modules/cjs/loader:936
  throw err;
  ^

Error: Cannot find module 'C:\@angular\cli\bin\ng.js'
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
    at Function.Module._load (node:internal/modules/cjs/loader:778:27)
    at node:internal/main/run_main_module:17:47 {
  code: 'MODULE_NOT_FOUND',
  requireStack: []
}

I have also tried the below command And get the same error message :

npm run build -- --c production
1 Answers

This error is showing because your npm install is not done properly or else the module has not compiled correctly

Try this :

rm -rf node_modules
npm install

if not working try this :

npm install --save module_name
Related