如何在Windows上构建VSCode?

时间:2017-07-18 09:09:07

标签: javascript node.js windows npm visual-studio-code

我正在尝试从源代码构建https://github.com/Microsoft/vscode,但我不确定该做什么。当我运行scripts\npm.bat install时,它已成功完成。然后我跑了scripts\code.bat,出现了一个陌生的窗口。它是编译版本吗?它似乎没有正常工作。

image

如何创建完整版?页面:

  1. https://github.com/Microsoft/vscode/wiki/How-to-Contribute#build-and-run-from-source
  2. 未提供如何从源创建可执行文件。当我运行scripts\npm.bat install时会发生什么?现在我只看到它在一些javascript文件中创建文件夹out / out-build,如下所示。这些文件是什么以及我用它们做了什么?

    image

    稍后我尝试运行scripts\code.bat并创建了一个类似于文件夹.build\electron上的稳定版本的可执行文件:

    image

    但是当我运行npm run watch时,这个错误就是抛出:

    FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory
    
    npm ERR! Windows_NT 10.0.15063
    npm ERR! argv "D:\\User\\Documents\\Nodejs\\bin\\node.exe" "D:\\User\\Documents\\Nodejs\\bin\\node_modules\\npm\\bin\\npm-cli.js" "run" "watch"
    npm ERR! node v6.11.0
    npm ERR! npm  v3.10.10
    npm ERR! code ELIFECYCLE
    npm ERR! code-oss-dev@1.15.0 watch: `gulp watch --max_old_space_size=4096`
    npm ERR! Exit status 3
    npm ERR!
    npm ERR! Failed at the code-oss-dev@1.15.0 watch script 'gulp watch --max_old_space_size=4096'.
    npm ERR! Make sure you have the latest version of node.js and npm installed.
    npm ERR! If you do, this is most likely a problem with the code-oss-dev package,
    npm ERR! not with npm itself.
    

    我发现了另一个问题:

    1. How to build release vscode version
    2. 但是我无法正确地弄清楚如何构建它。正手我想出了以下设置环境的步骤:

      1. 安装NodeJSnpm。看到 教程How to Install Node.js® and NPM on Windows
      2. 从cmd行运行此命令npm install --global --production windows-build-tools as 管理员。请参阅npm install error - MSB3428: Could not load the Visual C++ component “VCBuild.exe”
      3. 安装gulp。请参阅gulpjs / gulp#Getting Started
      4. 重现步骤

        1. git clone https://github.com/Microsoft/vscode
        2. cd vscode
        3. scripts\npm.bat install
        4. npm run watch
        5. 输出:F:\vscode>npm run watch
        6. 档案 npm-debug.log

          1)当我第一次运行命令scripts\npm.bat install时,这是输出: F:\vscode>scripts\npm.bat install

          2)当我第一次运行命令scripts\npm.bat install时,这是输出: F:\vscode>scripts\npm.bat install

          3)当我运行命令scripts\code.bat时,这是输出: F:\vscode>scripts\code.bat

          以下窗口显示:

          image

          4)当我按照npm owner ls code-oss-dev错误消息的要求运行命令npm run watch时,这是输出:

          F:\vscode>npm owner ls code-oss-dev
          npm ERR! owner ls Couldn't get owner data code-oss-dev
          npm ERR! Windows_NT 10.0.15063
          npm ERR! argv "D:\\User\\Documents\\Nodejs\\bin\\node.exe" "D:\\User\\Documents\\Nodejs\\bin\\node_modules\\npm\\bin\\npm-cli.js" "owner" "ls" "code-oss-dev"
          npm ERR! node v6.11.0
          npm ERR! npm  v3.10.10
          npm ERR! code E404
          
          npm ERR! 404 Registry returned 404 for GET on https://registry.npmjs.org/code-oss-dev
          npm ERR! 404
          npm ERR! 404  'code-oss-dev' is not in the npm registry.
          npm ERR! 404 You should bug the author to publish it (or use the name yourself!)
          npm ERR! 404
          npm ERR! 404 Note that you can also install from a
          npm ERR! 404 tarball, folder, http url, or git url.
          
          npm ERR! Please include the following file with any support request:
          npm ERR!     F:\vscode\npm-debug.log
          
          F:\vscode>
          

          5)当我按照npm bugs code-oss-dev错误消息的要求运行命令npm run watch时,这是错误输出:

          F:\vscode>npm bugs code-oss-dev
          npm ERR! Windows_NT 10.0.15063
          npm ERR! argv "D:\\User\\Documents\\Nodejs\\bin\\node.exe" "D:\\User\\Documents\\Nodejs\\bin\\node_modules\\npm\\bin\\npm-cli.js" "bugs" "code-oss-dev"
          npm ERR! node v6.11.0
          npm ERR! npm  v3.10.10
          npm ERR! code E404
          
          npm ERR! 404 Registry returned 404 for GET on https://registry.npmjs.org/code-oss-dev
          npm ERR! 404
          npm ERR! 404  'code-oss-dev' is not in the npm registry.
          npm ERR! 404 You should bug the author to publish it (or use the name yourself!)
          npm ERR! 404
          npm ERR! 404 Note that you can also install from a
          npm ERR! 404 tarball, folder, http url, or git url.
          
          npm ERR! Please include the following file with any support request:
          npm ERR!     F:\vscode\npm-debug.log
          
          F:\vscode>
          

          6)我还运行了命令gulp,这是输出: F:\vscode>gulp

          7)当我运行命令gulp compile-client-build时,这是输出:

          F:\vscode>gulp compile-client-build
          [08:36:37] Using gulpfile F:\vscode\gulpfile.js
          [08:36:37] Starting 'clean-client-build'...
          [08:36:37] Finished 'clean-client-build' after 49 ms
          [08:36:37] Starting 'compile-client-build'...
          [08:36:38] Starting compilation...
          [08:50:08] [monaco.d.ts] Starting monaco.d.ts generation
          [08:50:12] [monaco.d.ts] Finished monaco.d.ts generation
          [08:50:12] Finished compilation with 0 errors after 814540 ms
          [08:50:12] Finished 'compile-client-build' after 14 min
          

          8)当我运行命令gulp vscode-win32-ia32时,这是错误输出:

          [02:15:28] Starting 'vscode-win32-ia32'...
          internal/streams/legacy.js:59
                throw er; // Unhandled stream error in pipe.
                ^
          
          Error: read ECONNRESET
              at exports._errnoException (util.js:1018:11)
              at TLSWrap.onread (net.js:568:26)
          

          F:\vscode>gulp vscode-win32-ia32

          9)当我运行命令gulp vscode-win32-x64时,这是错误输出:

          [03:02:59] Starting 'vscode-win32-x64'...
          internal/streams/legacy.js:59
                throw er; // Unhandled stream error in pipe.
                ^
          
          Error: read ECONNRESET
              at exports._errnoException (util.js:1018:11)
              at TLSWrap.onread (net.js:568:26)
          

          F:\vscode>gulp vscode-win32-x64

          10)当我运行命令npm run gulp -- vscode-win32-ia32时,这是错误输出:

          FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory
          
          npm ERR! Windows_NT 10.0.15063
          npm ERR! argv "D:\\User\\Documents\\Nodejs\\bin\\node.exe" "D:\\User\\Documents\\Nodejs\\bin\\node_modules\\npm\\bin\\npm-cli.js" "run" "gulp" "--" "vscode-win32-ia32"
          npm ERR! node v6.11.0
          npm ERR! npm  v3.10.10
          npm ERR! code ELIFECYCLE
          npm ERR! code-oss-dev@1.15.0 gulp: `gulp --max_old_space_size=4096 "vscode-win32-ia32"`
          npm ERR! Exit status 3
          

          F:\vscode>npm run gulp -- vscode-win32-ia32

          上面的命令npm run gulp -- vscode-win32-ia32的文件 npm-debug.log

          11)当我运行命令gulp watch --max-old-space-size=4096时,这是输出,程序挂在这一行:

          sublime_shell

          F:\vscode>gulp watch --max-old-space-size=4096

          npm版

          F:\vscode>npm --version
          3.10.10
          
          F:\vscode>node --version
          v6.11.0
          
          F:\vscode>ver
          Microsoft Windows [Version 10.0.15063]
          
          F:\vscode>python --version
          Python 2.7.13 :: Continuum Analytics, Inc.
          
          • VSCode版本:code-oss-dev@1.15.0
          • 操作系统版本:Windows 10 build 15063 x64

          最初发布于:Failed at the code-oss-dev@1.15.0 watch script 'gulp watch --max_old_space_size=4096'

          相关问题:

          1. Development Environment Improvements (code.bat/code.sh)
          2. Errors Compiling from Source on Arch Linux
          3. Unable to setup vscode locally
          4. Debug Batch (.bat) files
          5. "JavaScript heap out of memory" when building on RHEL-7
          6. Failed at the electron-mksnapshot@1.6.0 install script
          7. Unhandled stream error in pipe
          8. stream.js:74 throw er; // Unhandled stream error in pipe.
          9. Node.js – events js 72 throw er unhandled 'error' event
          10. vscode-win32-ia32 build failure: JavaScript heap out of memory
          11. FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - process out of memory
          12. NPM / NPM#FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory
          13. 的NodeJS /节点#FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - JavaScript heap out of memory

2 个答案:

答案 0 :(得分:0)

问题似乎是vid.loop = true使用的过时版本6.11.0。对于VSCode问题跟踪器上的问题:Failed at the code-oss-dev@1.15.0 watch script 'gulp watch --max_old_space_size=4096',我们可能会按照以下步骤操作:

  1. 安装Node 7.9.0
  2. nodejs
  3. git clean -xfd .
  4. git pull
  5. 然后,如果没有错误:

    1. .\scripts\npm.bat install
    2. 运行它直到它告诉您编译成功。然后:

      1. npm run watch

答案 1 :(得分:0)

当我尝试按照说明进行操作时,我得到:

const

不知道为什么,但是似乎node-gyp找不到Visual Studio。