使用 zeit/pkg 打包 Node-Red

626*_*626 5 packaging node.js node-red zeit-pkg

我在 node-red 项目中使用zeit/pkg时遇到了一些问题。以下是重现问题的步骤:

  1. git clone https://github.com/node-red/node-red.git
  2. cd node-red
  3. npm install
  4. npm run build

  5. 在构建命令后,我将以下内容添加到我的 package.json 文件中:

    "pkg": {
       "assets": [
          "./red/**/*"
       ],
       "scripts": [
          "./red/**/*.js"
       ]
    }
    
    Run Code Online (Sandbox Code Playgroud)
  6. 运行命令 pkg .

运行后,pkg .我收到以下错误:

C:\xampp\htdocs\node-red>pkg .
> pkg@4.3.4
> Targets not specified. Assuming:
  node8-linux-x64, node8-macos-x64, node8-win-x64
> Warning Cannot resolve 'path.join(__dirname, '..', '..', 'package.json')'
  C:\xampp\htdocs\node-red\red\runtime\index.js
  Dynamic require may fail at run time, because the requested file
  is unknown at compilation time and not included into executable.
  Use a string literal as an argument for 'require', or leave it
  as is and specify the resolved file name in 'scripts' option.
> Warning Cannot resolve ''./' + aSettings.storageModule'
  C:\xampp\htdocs\node-red\red\runtime\storage\index.js
  Dynamic require may fail at run time, because the requested file
  is unknown at compilation time and not included into executable.
  Use a string literal as an argument for 'require', or leave it
  as is and specify the resolved file name in 'scripts' option.
> Warning Cannot resolve 'relPath'
  C:\xampp\htdocs\node-red\red\runtime\nodes\registry\loader.js
  Dynamic require may fail at run time, because the requested file
  is unknown at compilation time and not included into executable.
  Use a string literal as an argument for 'require', or leave it
  as is and specify the resolved file name in 'scripts' option.
Run Code Online (Sandbox Code Playgroud)

在 pkg 命令后运行 exe 给我这个错误: Node-RED has not been built. See README.md for details

任何帮助将不胜感激。这似乎是一个简单的路径问题,但我似乎无法让它工作。