javascript npx创建-React-应用程序不工作(节点:内部/模块/cjs/加载程序:1042)

qyzbxkaa  于 2023-03-06  发布在  Java
关注(0)|答案(1)|浏览(135)

我尝试输入“npx create-react-app myapp”来创建一个react应用程序,但我得到了以下错误:

node:internal/modules/cjs/loader:1042
  throw err;
  ^

Error: Cannot find module 'C:\Program Files\nodejs\node_modules\npm\bin\node_modules\npm\bin\npm-cli.js'
    at Module._resolveFilename (node:internal/modules/cjs/loader:1039:15)
    at Module._load (node:internal/modules/cjs/loader:885:27)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
    at node:internal/main/run_main_module:23:47 {
  code: 'MODULE_NOT_FOUND',
  requireStack: []
}

Node.js v18.13.0
node:internal/modules/cjs/loader:1042
  throw err;
  ^

Error: Cannot find module 'C:\Program Files\nodejs\node_modules\npm\bin\node_modules\npm\bin\npm-cli.js'
    at Module._resolveFilename (node:internal/modules/cjs/loader:1039:15)
    at Module._load (node:internal/modules/cjs/loader:885:27)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
    at node:internal/main/run_main_module:23:47 {
  code: 'MODULE_NOT_FOUND',
  requireStack: []
}

Node.js v18.13.0
Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts...

node:internal/modules/cjs/loader:1042
  throw err;
  ^

Error: Cannot find module 'C:\Program Files\nodejs\node_modules\npm\bin\node_modules\npm\bin\npm-cli.js'
    at Module._resolveFilename (node:internal/modules/cjs/loader:1039:15)
    at Module._load (node:internal/modules/cjs/loader:885:27)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
    at node:internal/main/run_main_module:23:47 {
  code: 'MODULE_NOT_FOUND',
  requireStack: []
}

Node.js v18.13.0
node:internal/modules/cjs/loader:1042
  throw err;
  ^

Error: Cannot find module 'C:\Program Files\nodejs\node_modules\npm\bin\node_modules\npm\bin\npm-cli.js'
    at Module._resolveFilename (node:internal/modules/cjs/loader:1039:15)
    at Module._load (node:internal/modules/cjs/loader:885:27)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
    at node:internal/main/run_main_module:23:47 {
  code: 'MODULE_NOT_FOUND',
  requireStack: []
}

Node.js v18.13.0

Aborting installation.
  npm install --no-audit --save --save-exact --loglevel error react react-dom react-scripts@0.9.x has failed.

Deleting generated file... package.json
Deleting ousseini_portfolio/ from C:\Users\USER\Desktop
Done.
oxalkeyp

oxalkeyp1#

问题解决:第1步:返回首页rm-射频节点模块步骤3:npm install---等待安装完全完成---
然后尝试运行:npm启动

  • ---------现在应该能用了-----------

相关问题