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

标签 reactjs ubuntu npm

操作系统-ubuntu
IDE-VS-代码npx create-react-app工作正常,当我遇到 Create React App requires Node 14 or higher. 的建议时,我想从事个人项目我尝试使用以下命令更新节点 sudo npm cache clean -f然后 sudo npm install -g n然后我跑了 sudo n stable安装了以下内容:v16.13.1(使用 npm 8.1.2)。当我尝试运行 npx create-react-app我收到以下错误

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' ]
}
收到错误后我尝试了什么,
下面的解决方案;
React: create-react-app fails with error "Cannot find module 'lodash'"
我该如何解决这个问题,以便我可以开始我的个人项目并学习框架?

最佳答案

重新启动 vs-code 并开始正常工作。希望这可以帮助面临同样错误的人

关于reactjs - react : create-react-app fails with error "Cannot find module ' libnpx',我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/70402406/

相关文章:

javascript - 如何使用 Redux 更新状态?

javascript - React.FunctionComponent 和普通的 JS 函数组件有什么区别?

c - valgrind 无效读取大小

angular - 执行 "ng serve"或 "npm start"命令浏览器未自动打开

javascript - 如何告诉 npm 在安装时使用父项目的依赖项构建模块?

javascript - 如何在 react 应用程序中从 clientJS 获取浏览器指纹?

javascript - 如何将列表附加到 FormData?

javascript - 如何在 Node.js Nginx 中允许 http 请求?

node.js - docker:安装 node.js 应用程序有问题,因为 docker 以 root 身份运行

node.js - 无法更新 npm 包 : ERR! 代码 EEXIST