Warning: Accessing non-existent property "?" of module export...
编译项目的时候提示如下警告,如何才能定位到警告的具体位置呢
(node:48258) Warning: Accessing non-existent property 'lineno' of module exports inside circular dependency
(Use `node --trace-warnings ...` to show where the warning was created)
(node:48258) Warning: Accessing non-existent property 'column' of module exports inside circular dependency
(node:48258) Warning: Accessing non-existent property 'filename' of module exports inside circular dependency
(node:48258) Warning: Accessing non-existent property 'lineno' of module exports inside circular dependency
(node:48258) Warning: Accessing non-existent property 'column' of module exports inside circular dependency
(node:48258) Warning: Accessing non-existent property 'filename' of module exports inside circular dependency
按照警告提示,使用如下命令:
node --trace-warnings ...
得到如下的结果也不能很好的定位具体问题是什么引起的:
internal/modules/cjs/loader.js:1017
throw err;
^
Error: Cannot find module '/Users/unofficial/www/work'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:1014:15)
at Function.Module._load (internal/modules/cjs/loader.js:884:27)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
at internal/main/run_main_module.js:17:47 {
code: 'MODULE_NOT_FOUND',
requireStack: []
}
为了看到详细的信息,我们可以使用下面的命令:
# yarn dev 是我项目本身需要执行的开发命令
npx cross-env NODE_OPTIONS="--trace-warnings" yarn dev
得到如下警告提示,可以分析出是和 stylus 相关,但是这个具体的问题也和 NodeJs 版本有关系,具体如何解决问题呢
(node:49923) Warning: Accessing non-existent property 'lineno' of module exports inside circular dependency
at emitCircularRequireWarning (internal/modules/cjs/loader.js:814:11)
at Object.get (internal/modules/cjs/loader.js:825:5)
at Boolean.Node [as constructor] (/Users/unofficial/www/work/dw-weapp-base/miniprogram/node_modules/stylus/lib/nodes/node.js:44:23)