运行时
npm run dev
我突然开始出错,但几乎没有对项目代码进行任何更改:
TypeError: Class extends value undefined is not a constructor or null
at Object.618 (/Users/EugeneBos/Websites/dotalaning/node_modules/next/dist/compiled/postcss-scss/scss-syntax.js:1:100)
at __nccwpck_require__ (/Users/EugeneBos/Websites/dotalaning/node_modules/next/dist/compiled/postcss-scss/scss-syntax.js:1:11735)
at Object.270 (/Users/EugeneBos/Websites/dotalaning/node_modules/next/dist/compiled/postcss-scss/scss-syntax.js:1:413)
at __nccwpck_require__ (/Users/EugeneBos/Websites/dotalaning/node_modules/next/dist/compiled/postcss-scss/scss-syntax.js:1:11735)
at Object.327 (/Users/EugeneBos/Websites/dotalaning/node_modules/next/dist/compiled/postcss-scss/scss-syntax.js:1:260)
at __nccwpck_require__ (/Users/EugeneBos/Websites/dotalaning/node_modules/next/dist/compiled/postcss-scss/scss-syntax.js:1:11735)
at Object.845 (/Users/EugeneBos/Websites/dotalaning/node_modules/next/dist/compiled/postcss-scss/scss-syntax.js:1:3733)
at __nccwpck_require__ (/Users/EugeneBos/Websites/dotalaning/node_modules/next/dist/compiled/postcss-scss/scss-syntax.js:1:11735)
at /Users/EugeneBos/Websites/dotalaning/node_modules/next/dist/compiled/postcss-scss/scss-syntax.js:1:11863
at Object.<anonymous> (/Users/EugeneBos/Websites/dotalaning/node_modules/next/dist/compiled/postcss-scss/scss-syntax.js:1:11889)
at Module._compile (node:internal/modules/cjs/loader:1108:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1137:10)
at Module.load (node:internal/modules/cjs/loader:973:32)
at Function.Module._load (node:internal/modules/cjs/loader:813:14)
at Module.require (node:internal/modules/cjs/loader:997:19)
at require (node:internal/modules/cjs/helpers:92:18)
修改应用代码使其不包含任何文件或加载任何内容仍然会产生相同的错误。
答案 0 :(得分:5)
好的,删除 node_modules 并重新安装所有东西都有帮助。
rm -rf node_modules
npm install
答案 1 :(得分:0)
如果您将 yarn 与 npm 依赖项混合在一起,也可能会发生这种情况。 试试
这对我有用