Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

React: create-react-app fails with error "Cannot find module 'libnpx'

OS-ubuntu

IDE-VS-Code

npx create-react-app was working fine,I wanted to work on a personal project when i run in to a suggestion that Create React App requires Node 14 or higher. I tried updating node using the following commands sudo npm cache clean -f and then sudo npm install -g n then i ran sudo n stable the following was installed installed : v16.13.1 (with npm 8.1.2).When i tried running npx create-react-app I got the following error

Error: Cannot find module 'libnpx'
Require stack:
- /usr/share/npm/bin/npx-cli.js
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
    at Function.Module._load (node:internal/modules/cjs/loader:778:27)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at Object.<anonymous> (/usr/share/npm/bin/npx-cli.js:3:13)
    at Module._compile (node:internal/modules/cjs/loader:1101:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [ '/usr/share/npm/bin/npx-cli.js' ]
}

What i tried after getting the error, The solution below; React: create-react-app fails with error "Cannot find module 'lodash'"

How do I approach resolving this problem so that I can get started with my personal project and learning the framework?

like image 829
gatwirival Avatar asked Sep 03 '26 18:09

gatwirival


1 Answers

Restart your terminal after updating node version.

like image 131
mosszhd Avatar answered Sep 06 '26 08:09

mosszhd



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!