启动和运行
在 mac 上我们 clone 了代码,运行的时候发现一堆错误:
No receipt for 'com.apple.pkg.CLTools_Executables' found at '/'.
No receipt for 'com.apple.pkg.DeveloperToolsCLILeo' found at '/'.
No receipt for 'com.apple.pkg.DeveloperToolsCLI' found at '/'.
gyp: No Xcode or CLT version detected!
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack at ChildProcess.onCpExit (/xxxxxxxxxx/.nvm/versions/node/v12.13.0/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:351:16)
gyp ERR! stack at ChildProcess.emit (events.js:210:5)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:272:12)
gyp ERR! System Darwin 19.6.0
在这里找到了原因和解决方案:https://www.cnblogs.com/coolestcode/p/13389408.html
我这里执行了一下:sudo rm -rf /Library/Developer/CommandLineTools
这个就好了,yarn install 过程稍微有点慢,不急。
可能并不会一番风顺,你可能还会遇到这样的现象:
yarn run v1.22.4
$ node build/lib/electron
Error creating download stream to download electron-v11.0.2-darwin-x64.zip
internal/streams/legacy.js:59
throw er; // Unhandled stream error in pipe.
^
Error: Request failed with code 403
at Request.<anonymous> (.xxxxxx/vscode/node_modules/github-releases-ms/lib/github.js:56:25)
at Request.emit (events.js:210:5)
at Request.onRequestResponse (xxxxx/vscode/node_modules/request/request.js:1066:10)
at ClientRequest.emit (events.js:210:5)
at HTTPParser.parserOnIncomingClient [as onIncoming] (_http_client.js:583:27)
at HTTPParser.parserOnHeadersComplete (_http_common.js:115:17)
at TLSSocket.socketOnData (_http_client.js:456:22)
at TLSSocket.emit (events.js:210:5)
at addChunk (_stream_readable.js:308:12)
at readableAddChunk (_stream_readable.js:289:11)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
$ node build/lib/electron
internal/streams/legacy.js:59
throw er; // Unhandled stream error in pipe.
^
Error: API rate limit exceeded for 61.120.150.78. (But here's the good news: Authenticated requests get a higher rate limit. Check out the documentation for more details.)
at Request._callback (xxx/vscode/node_modules/github-releases-ms/lib/github.js:83:17)
at Request.self.callback (xxx/vscode/node_modules/request/request.js:185:22)
at Request.emit (events.js:210:5)
at Request.<anonymous> (xxxxx/vscode/node_modules/request/request.js:1161:10)
at Request.emit (events.js:210:5)
at IncomingMessage.<anonymous> (xxxx/vscode/node_modules/request/request.js:1083:12)
at Object.onceWrapper (events.js:299:28)
at IncomingMessage.emit (events.js:215:7)
at endReadableNT (_stream_readable.js:1183:12)
at processTicksAndRejections (internal/process/task_queues.js:80:21)
error Command failed with exit code 1.
但我好像啥也没做,再多试了几次就好了:
➜ vscode git:(master) ✗ ./scripts/code.sh
yarn run v1.22.4
$ node build/lib/electron
↓ ffmpeg-v11.0.2-darwin-x64.zip [====================] 100%
Downloaded ffmpeg-v11.0.2-darwin-x64.zip
↓ electron-v11.0.2-darwin-x64.zip [======--------------] 29%
估计是服务不稳定~
我们终于跑起来了
开发和调试
我们希望修改代码生效的话,则:
yarn watch
可能再次启动的时候:./scripts/code.sh
会报:
[Error: ENOENT: no such file or directory, open 'xxxxx/vscode/out/vs/code/electron-main/main.js'] {
errno: -2,
code: 'ENOENT',
syscall: 'open',
path: 'xxxxx/vscode/out/vs/code/electron-main/main.js',
phase: 'loading',
moduleId: 'vs/code/electron-main/main',
neededBy: [ '===anonymous1===' ]
}
等待 watch 出现:Finished compilation extensions with 0 errors after 39224ms
就好了。
我们可以修改一句话试试:src/vs/code/electron-main/app/ts
增加一句:
console.log('hello, i am going to learning vscode');
constructor(
private readonly mainIpcServer: Server,
private readonly userEnv: IProcessEnvironment,
@IInstantiationService private readonly instantiationService: IInstantiationService,
@ILogService private readonly logService: ILogService,
@IEnvironmentMainService private readonly environmentService: IEnvironmentMainService,
@ILifecycleMainService private readonly lifecycleMainService: ILifecycleMainService,
@IConfigurationService private readonly configurationService: IConfigurationService,
@IStateService private readonly stateService: IStateService
) {
super();
console.log('hello, i am going to learning vscode');
this.registerListeners();
}
因此,可以看到打出了日志:
yarn run v1.22.4
$ node build/lib/electron
✨ Done in 0.79s.
[11:43:17] Syncronizing built-in extensions...
[11:43:17] You can manage built-in extensions with the --builtin flag
[11:43:17] [marketplace] ms-vscode.node-debug@1.44.14 ✔︎
[11:43:17] [marketplace] ms-vscode.node-debug2@1.42.5 ✔︎
[11:43:17] [marketplace] ms-vscode.references-view@0.0.73 ✔︎
[11:43:17] [marketplace] ms-vscode.js-debug-companion@1.0.8 ✔︎
[11:43:17] [marketplace] ms-vscode.js-debug@1.51.0 ✔︎
[11:43:17] [marketplace] ms-vscode.vscode-js-profile-table@0.0.11 ✔︎
[11:43:17] [marketplace] ms-vscode.github-browser@0.0.13 ✔︎
(electron) Sending uncompressed crash reports is deprecated and will be removed in a future version of Electron. Set { compress: true } to opt-in to the new behavior. Crash reports will be uploaded gzipped, which most crash reporting servers support.
hello, i am going to learning vscode
(node:60311) electron: The default of contextIsolation is deprecated and will be changing from false to true in a future release of Electron. See https://github.com/electron/electron/issues/23506 for more information
常见问题FAQ
- 免费下载或者VIP会员专享资源能否直接商用?
- 本站所有资源版权均属于原作者所有,这里所提供资源均只能用于参考学习用,请勿直接商用。若由于商用引起版权纠纷,一切责任均由使用者承担。更多说明请参考 VIP介绍。
- 提示下载完但解压或打开不了?
- 找不到素材资源介绍文章里的示例图片?
- 模板不会安装或需要功能定制以及二次开发?
发表评论
还没有评论,快来抢沙发吧!