起步
使用 nvs 安装并使用最新版 Node
            
            
              sh
              
              
            
          
          nvs add latest
        
            
            
              sh
              
              
            
          
          nvs use latest
        
创建项目
            
            
              sh
              
              
            
          
          mkdir single-exe
        
            
            
              sh
              
              
            
          
          cd single-exe
        添加 hello.js 文件
            
            
              js
              
              
            
          
          console.log(`Hello, ${process.argv[2]}!`);
        添加 sea-config.json 文件
            
            
              json
              
              
            
          
          { "main": "hello.js", "output": "sea-prep.blob" }
        
执行命令
            
            
              zsh
              
              
            
          
          node --experimental-sea-config sea-config.json 
        
以下命令以 MacOS 为例,具体查看 Single executable applications
            
            
              sh
              
              
            
          
          cp $(command -v node) hello 
        
            
            
              sh
              
              
            
          
          codesign --remove-signature hello 
        
            
            
              sh
              
              
            
          
          npx postject hello NODE_SEA_BLOB sea-prep.blob \
    --sentinel-fuse NODE_SEA_FUSE_fce680ab2cc467b6e072b8b5df1996b2 \
    --macho-segment-name NODE_SEA
        
生成可执行文件 hello

            
            
              sh
              
              
            
          
          codesign --sign - hello 
        最后执行 hello
            
            
              sh
              
              
            
          
          ./hello world
        
本文完,感谢阅读🌹