-3

I have upgraded my VM node version but my error Log file appears with other version, when i try to build my react application. node -v gives me - v14.17.5

Creating an optimized production build...
Failed to compile.

createRequire is not a function
Referenced from: BaseConfig

npm ERR! Linux 4.4.0-169-generic
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "build"
npm ERR! node v10.0.0
npm ERR! npm  v3.10.10
npm ERR! code ELIFECYCLE
npm ERR! epesi-dash-ui@1.0.0 build: `react-scripts build`
npm ERR! Exit status 1
Mbanda
  • 968
  • 11
  • 21
  • You can try removing the npm cache and upgrade to the latest version of the node and npm will resolve the issue. 1.`sudo npm cache clean -f` , 2.`sudo npm install -g n install n` , 3.`sudo n stable` The first command will force clean the npm package manager's cache, After the second and third commands, a stable version of the node and npm will be installed. then you can execute **npm i** and **npm run build** for creating an optimized production build. Try these commands and let me know if this resolves the issue. – Srividya Aug 23 '21 at 16:27

1 Answers1

0

It all happened to be failed update of files in /usr/local/bin after nvm upgrade.

The following answer solved this. https://stackoverflow.com/a/65581673/9530555

Mbanda
  • 968
  • 11
  • 21