TypeError:运行next.js时,未定义的类扩展值不是构造函数或为null

nhhxz33t  于 2023-01-30  发布在  其他
关注(0)|答案(4)|浏览(122)

跑步时

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)

修改应用程序的代码使其不包含任何文件或加载任何内容仍会产生相同的错误。

ao218c7q

ao218c7q1#

好的,删除node_modules并重新安装所有组件已经有所帮助。

rm -rf node_modules
npm install
lb3vh1jj

lb3vh1jj2#

我知道rm -rf没有什么问题,但是**npkill**是一个非常好的工具:

  1. npx npkill
    1.删除相应的node_modules文件夹
  2. yarnnpm i
svdrlsy4

svdrlsy43#

如果你把yarn和npm依赖项混在一起,也可能会发生这种情况。

  1. rm-rf节点模块
  2. npm安装
    这在我的情况下起作用
ia2d9nvy

ia2d9nvy4#

只是更新npm...
有时它与npm版本有关,尝试使用最新版本的npm。这发生在我的v6.14上,一旦我将npm更新到v8.1,问题就解决了。

相关问题