问题描述
我是NodeJS的新手,正在尝试在Windows终端上安装Node-Inspector。安装时出现此错误。
PS C:\Users\rahul> npm install -g node-inspector
npm WARN deprecated hawk@3.1.3: This module moved to @hapi/hawk. Please make sure to switch over as this distribution is no longer supported and may contain bugs and critical security issues.
npm WARN deprecated request@2.81.0: request has been deprecated,see https://github.com/request/request/issues/3142
npm WARN deprecated sntp@1.0.9: This module moved to @hapi/sntp. Please make sure to switch over as this distribution is no longer supported and may contain bugs and critical security issues.
m/support). Please upgrade to the latest version to get the best features,bug fixes,and security patches. If you are unable to upgrade at this time,paid support is available for older versions (hapi.im/commercial).
npm WARN deprecated boom@2.10.1: This version has been deprecated in accordance with the hapi support policy (hapi.im/support). Please upgrade to the latest version to get the best features,paid support is available for older versions (hapi.im/commercial).
npm WARN deprecated hoek@2.16.3: This version has been deprecated in accordance with the hapi support policy (hapi.im/support). Please upgrade to the latest version to get the best features,paid support is available for older versions (hapi.im/commercial).
npm WARN deprecated har-validator@4.2.1: this library is no longer supported
> v8-profiler@5.7.0 preinstall C:\Users\rahul\AppData\Roaming\npm\node_modules\node-inspector\node_modules\v8-profiler
> node -e 'process.exit(0)'
> v8-debug@1.0.1 preinstall C:\Users\rahul\AppData\Roaming\npm\node_modules\node-inspector\node_modules\v8-debug
> node -e 'process.exit(0)'
npm ERR! code EEXIST
npm ERR! dest C:\Users\rahul\AppData\Roaming\npm\node-inspector.cmd
npm ERR! EEXIST: file already exists,cmd shim 'C:\Users\rahul\AppData\Roaming\npm\node_modules\node-inspector\bin\inspector.js' -> 'C:\Users\rahul\AppData\Roaming\npm\node-inspector.cmd'
npm ERR! File exists: C:\Users\rahul\AppData\Roaming\npm\node-inspector.cmd
npm ERR! Remove the existing file and try again,or run npm
npm ERR! with --force to overwrite files recklessly.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\rahul\AppData\Roaming\npm-cache\_logs\2020-10-02T12_36_01_288Z-debug.log
PS C:\Users\rahul> node-inspector
internal/modules/cjs/loader.js:968
throw err;
^
Error: Cannot find module 'C:\Users\rahul\AppData\Roaming\npm\node_modules\node-inspector\bin\inspector.js'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:965:15)
at Function.Module._load (internal/modules/cjs/loader.js:841: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: []
}
我也已将ubuntu安装为WSL。 谢谢。
解决方法
尝试覆盖当前安装的版本:npm install -g node-inspector --force