5

I am having some issues using zeit/pkg on my node-red project. Here are the steps to replicate the issue:

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

  5. After build command I added the following to my package.json file:

    "pkg": {
       "assets": [
          "./red/**/*"
       ],
       "scripts": [
          "./red/**/*.js"
       ]
    }
    
  6. Run the command pkg .

After running pkg . I get the following errors:

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.

Running the exe after the pkg command gives me this error: Node-RED has not been built. See README.md for details

Any help would be greatly appreciated. It seems like a simple path issue but I can't seem to get it working.

hardillb
  • 54,545
  • 11
  • 67
  • 105
626
  • 1,159
  • 2
  • 16
  • 27
  • You not actually stated what the problem is here. The packaging step shows a bunch of warnings, but you've not said what happens if you try and run it after packaging – hardillb Aug 18 '18 at 09:06
  • When I run the exe it says "Node-RED has not been built." and exits. – 626 Aug 18 '18 at 10:04
  • I have never used zeit/pkg but I am wondering if the problem is not with the installation of node-red. I have never installed Node-RED that way so I can not immediately say. Did you try to start node-RED and checked that you could connect to the node-RED editor using :1880 ? – JanVdA Aug 27 '18 at 07:14
  • Does this solve your problem? https://nodered.org/docs/getting-started/installation.html#for-development---from-github – snek Aug 28 '18 at 20:21
  • If you want to package node-red in windows. https://www.youtube.com/watch?v=C2wiA0F9vPo – greatdsa Jun 10 '23 at 16:56

0 Answers0