gpt4 book ai didi

node.js - 每当我尝试使用 Next.js 运行 'npm run dev' 时都找不到错误模块

转载 作者:行者123 更新时间:2023-12-04 12:35:31 29 4
gpt4 key购买 nike

每当我跑 npm run dev我收到这个错误。
我试图删除 node_modules并使用 npm install 重新安装它但这没有用。然后我试图删除两个 node_modulespackage-lock.json并重新安装它们,这不起作用。我什至尝试将 Node 升级到最新版本,但我仍然遇到这个问题。
我很感激我得到的任何帮助。先感谢您。

Error: Cannot find module 'C:\Users\jaydev\Desktop\ecommerce\fashionsite\node_modules\postcss\lib\parser'
at createEsmNotFoundErr (node:internal/modules/cjs/loader:952:15)
at finalizeEsmResolution (node:internal/modules/cjs/loader:945:15)
at resolveExports (node:internal/modules/cjs/loader:473:14)
at Function.Module._findPath (node:internal/modules/cjs/loader:513:31)
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:911:27)
at Function.Module._load (node:internal/modules/cjs/loader:769:27)
at Module.require (node:internal/modules/cjs/loader:997:19)
at require (node:internal/modules/cjs/helpers:92:18)
at Object.552 (C:\Users\jaydev\Desktop\ecommerce\fashionsite\node_modules\next\dist\compiled\postcss-scss\scss-syntax.js:1:11590)
at __webpack_require__ (C:\Users\jaydev\Desktop\ecommerce\fashionsite\node_modules\next\dist\compiled\postcss-scss\scss-syntax.js:1:11735)
at Object.560 (C:\Users\jaydev\Desktop\ecommerce\fashionsite\node_modules\next\dist\compiled\postcss-scss\scss-syntax.js:1:400)
at __webpack_require__ (C:\Users\jaydev\Desktop\ecommerce\fashionsite\node_modules\next\dist\compiled\postcss-scss\scss-syntax.js:1:11735)
at Object.290 (C:\Users\jaydev\Desktop\ecommerce\fashionsite\node_modules\next\dist\compiled\postcss-scss\scss-syntax.js:1:260)
at __webpack_require__ (C:\Users\jaydev\Desktop\ecommerce\fashionsite\node_modules\next\dist\compiled\postcss-scss\scss-syntax.js:1:11735)
at Object.632 (C:\Users\jaydev\Desktop\ecommerce\fashionsite\node_modules\next\dist\compiled\postcss-scss\scss-syntax.js:1:3733)
at __webpack_require__ (C:\Users\jaydev\Desktop\ecommerce\fashionsite\node_modules\next\dist\compiled\postcss-scss\scss-syntax.js:1:11735) {
code: 'MODULE_NOT_FOUND',
path: 'C:\\Users\\jaydev\\Desktop\\ecommerce\\fashionsite\\node_modules\\postcss\\package.json'
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! fashionsite@0.1.0 dev: `next dev`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the fashionsite@0.1.0 dev script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\jaydev\AppData\Roaming\npm-cache\_logs\2020-12-25T07_06_40_981Z-debug.log
包.json:
{
"name": "时尚网站",
“版本”:“0.1.0”,
“私有(private)”:真的,
“脚本”:{
"dev": "下一个开发者",
"build": "下一个构建",
“开始”:“下次开始”
},
“依赖关系”:{
"下一个": "10.0.4",
“ react ”:“17.0.1”,
“ react DOM”:“17.0.1”
}
}

最佳答案

  • 停止你的开发服务器 (ctrl+c)
  • 删除 .next项目根文件夹中的文件夹。
  • 删除 node_modules文件夹和 package-lock.json文件也是。
  • 运行 npm cache clean --force
  • 运行 npm install
  • 运行 npm run dev

  • 如果上述方法不起作用,请打开文件资源管理器并查看指定的文件是否存在于指定的路径中: C:\Users\jaydev\Desktop\ecommerce\fashionsite\node_modules\postcss\lib\parser.js如果存在,请尝试将您的项目文件夹移动到 desktop 以外的路径。由于 Windows 权限问题,如果问题已解决,请告诉我。

    关于node.js - 每当我尝试使用 Next.js 运行 'npm run dev' 时都找不到错误模块,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/65446047/

    29 4 0
    Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
    广告合作:1813099741@qq.com 6ren.com