在TsServer日志中遇到此错误:
[20:0:44.403] NPM location: npm (explicit '--npmLocation' not provided)
[20:0:44.404] validateDefaultNpmLocation: true
[20:0:44.404] Npm config file: /Users/<>/Library/Caches/typescript/3.5/package.json
[20:0:44.404] Updating types-registry npm package...
[20:0:44.405] Exec: npm install --ignore-scripts types-registry@latest
[20:0:44.417] Failed. stdout:
stderr:
env: node: No such file or directory
[20:0:44.418] Updated types-registry npm package
我认为由于删除系统节点并使用nvm tsserver无法获取节点路径
已设置默认的nvm:
[127] % nvm ls
-> v10.16.0
v12.5.0
default -> 10 (-> v10.16.0)
node -> stable (-> v12.5.0) (default)
stable -> 12.5 (-> v12.5.0) (default)
iojs -> N/A (default)
unstable -> N/A (default)
lts/* -> lts/dubnium (-> v10.16.0)
lts/argon -> v4.9.1 (-> N/A)
lts/boron -> v6.17.1 (-> N/A)
lts/carbon -> v8.16.0 (-> N/A)
lts/dubnium -> v10.16.0
在VSCODE中设置以下设置:
{
"typescript.tsserver.log": "verbose",
"terminal.external.osxExec": "iTerm.app",
"terminal.integrated.shell.osx": "/bin/zsh",
"terminal.integrated.shellArgs.osx": []
}