当我在终端中运行eslint --init
时,以下是我的错误消息:
Checking peerDependencies of eslint-config-airbnb-base@latest
Installing eslint-config-airbnb-base@latest, eslint-plugin-import@^2.7.0
npm WARN eslint-config-airbnb-base@12.1.0 requires a peer of eslint@^4.9.0 but none is installed. You must install peer dependencies yourself.
npm WARN eslint-plugin-import@2.9.0 requires a peer of eslint@2.x - 4.x but none is installed. You must install peer dependencies yourself.
npm WARN code2@1.0.0 No description
npm WARN code2@1.0.0 No repository field.
npm ERR! path C:\Users\lastF\Documents\Code2\node_modules\concat-map
npm ERR! code ENOENT
npm ERR! errno -4058
npm ERR! syscall rename
npm ERR! enoent ENOENT: no such file or directory, rename 'C:\Users\lastF\Documents\Code2\node_modules\concat-map' -> 'C:\Users\lastF\Documents\Code2\node_modules\.concat-map.DELETE'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\lastF\AppData\Roaming\npm-cache\_logs\2018-03-29T22_41_15_318Z-debug.log
Successfully created .eslintrc.js file in C:\Users\lastF\Documents\Code2
不确定这里发生了什么......我在终端尝试了npm install concat-map
,但这也行不通。
答案 0 :(得分:0)
我能够通过关闭VS Code并从gitBash命令行运行“npm uninstall eslint”后跟“npm install eslint”来解决类似的问题。
之后,我重新启动了VS Code,一切都很好。