我正在使用 Next js,每当我运行脚本“npm run dev”时,我都会收到此错误,这让我很困惑,因为当我检查 postcss 文件夹中的“lib”文件夹时,我发现了 parser.js 文件就在那里,为什么节点找不到模块。
Error: Cannot find module 'C:\Users\jaydev\Documents\create-test\test-project\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\Documents\create-test\test-project\node_modules\next\dist\compiled\postcss-scss\scss-syntax.js:1:11590)
at __nccwpck_require__ (C:\Users\jaydev\Documents\create-test\test-project\node_modules\next\dist\compiled\postcss-scss\scss-syntax.js:1:11735)
at Object.270 (C:\Users\jaydev\Documents\create-test\test-project\node_modules\next\dist\compiled\postcss-scss\scss-syntax.js:1:400)
at __nccwpck_require__ (C:\Users\jaydev\Documents\create-test\test-project\node_modules\next\dist\compiled\postcss-scss\scss-syntax.js:1:11735)
at Object.327 (C:\Users\jaydev\Documents\create-test\test-project\node_modules\next\dist\compiled\postcss-scss\scss-syntax.js:1:260)
at __nccwpck_require__ (C:\Users\jaydev\Documents\create-test\test-project\node_modules\next\dist\compiled\postcss-scss\scss-syntax.js:1:11735)
at Object.845 (C:\Users\jaydev\Documents\create-test\test-project\node_modules\next\dist\compiled\postcss-scss\scss-syntax.js:1:3733)
at __nccwpck_require__ (C:\Users\jaydev\Documents\create-test\test-project\node_modules\next\dist\compiled\postcss-scss\scss-syntax.js:1:11735) {
code: 'MODULE_NOT_FOUND',
path: 'C:\\Users\\jaydev\\Documents\\create-test\\test-project\\node_modules\\postcss\\package.json'
}
npm ERR! code 1
npm ERR! path C:\Users\jaydev\Documents\create-test\test-project
npm ERR! command failed
npm ERR! command C:\WINDOWS\system32\cmd.exe /d /s /c next dev
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\jaydev\AppData\Local\npm-cache\_logs\2021-02-21T05_42_49_737Z-debug.log
答案 0 :(得分:0)