Error: Cannot find module 'nan'
npm install 报错如何解决
- npm clean cache
- 删除node_modules文件夹
- npm install
- 点赞、点赞、点赞
> node install.js
internal/modules/cjs/loader.js:883
throw err;
^
Error: Cannot find module 'nan'
Require stack:
- /Users/zqc/Desktop/works/haomatousu/node_modules/webpack-dev-server/node_modules/fsevents/[eval]
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:880:15)
at Function.Module._load (internal/modules/cjs/loader.js:725:27)
at Module.require (internal/modules/cjs/loader.js:952:19)
at require (internal/modules/cjs/helpers.js:88:18)
at [eval]:1:1
at Script.runInThisContext (vm.js:133:18)
at Object.runInThisContext (vm.js:310:38)
at internal/process/execution.js:77:19
at [eval]-wrapper:6:22
at evalScript (internal/process/execution.js:76:60) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'/Users/zqc/Desktop/works/haomatousu/node_modules/webpack-dev-server/node_modules/fsevents/[eval]'
]
}
gyp: Call to 'node -e "require('nan')"' returned exit status 1 while in binding.gyp. while trying to load binding.gyp
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack at ChildProcess.onCpExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:351:16)
gyp ERR! stack at ChildProcess.emit (events.js:315:20)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:277:12)
gyp ERR! System Darwin 20.3.0
gyp ERR! command "/usr/local/bin/node"