NodeJS npm run start不支持我的react应用

2izufjch  于 2023-04-05  发布在  Node.js
关注(0)|答案(2)|浏览(118)

我刚刚开始做一个项目。我克隆了repo,通过运行npm i安装了依赖项,但我一直得到这个错误:

PS C:\Users\antfo\Documents\dev\TheCircle\thecircle-dapp> npm run start

> @my-app/monorepo@1.0.0 start
> npm run react-app:start

> @my-app/monorepo@1.0.0 react-app:start
> yarn workspace @my-app/react-app start

yarn workspace v1.3.2
(node:18940) [DEP0005] DeprecationWarning: Buffer() is deprecated due to security and usability issues. Please use the Buffer.alloc(), Buffer.allocUnsafe(), or Buffer.from() methods instead.
(Use `node --trace-deprecation ...` to show where the warning was created)
error An unexpected error occurred: "patterns.map is not a function".
info If you think this is a bug, please open a bug report with the information provided in "C:\\Users\\antfo\\Documents\\dev\\TheCircle\\thecircle-dapp\\yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/workspace for documentation about this command.
PS C:\Users\antfo\Documents\dev\TheCircle\thecircle-dapp> node --trace-deprecation ...
node:internal/modules/cjs/loader:936
  throw err;
  ^

Error: Cannot find module 'C:\Users\antfo\Documents\dev\TheCircle\thecircle-dapp\...'
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
    at Function.Module._load (node:internal/modules/cjs/loader:778:27)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
    at node:internal/main/run_main_module:17:47 {
  code: 'MODULE_NOT_FOUND',
  requireStack: []
}

我尝试了不同的Node版本,但它不工作。这是我第一次在克隆的仓库上工作,所以我可能错过了一些东西。

vhmi4jdf

vhmi4jdf1#

这可能与在同一个项目中同时使用yarn和npm有关,请尝试删除'node_modules'和'yarn.lock'文件夹,然后运行'npm install'或'yarn install'并坚持使用其中一个,因为不建议同时使用yarn和npm。然后重试

xcitsw88

xcitsw882#

这是因为你没有在repo中安装依赖项。
只要安装依赖项它将工作

相关问题