Prebid.js icon indicating copy to clipboard operation
Prebid.js copied to clipboard

How to install prebid and build

Open headerbidding opened this issue 10 years ago • 19 comments

I need to be able to track timeouts by bidder. I used to use GA tacking to do that, but it is no longer available in the direct download, unless I compile my own prebid.js I have never used node.js and gulp. Questions:

  1. Are there step-by step instructions on how to set up and use node.js and gulp?
  2. Is there another way to use GA (or other anaylytics) without having to learn node.js and gulp?

headerbidding avatar Nov 24 '16 20:11 headerbidding

brew install node && npm i -g gulp on Mac

then just use the build commands on Github.

tedrand avatar Nov 26 '16 15:11 tedrand

@headerbidding did the above work for you?

mkendall07 avatar Nov 28 '16 21:11 mkendall07

I don't know what "brew install node && npm install gulp" is and I do not have a Mac. I use Windows 7.

headerbidding avatar Nov 28 '16 21:11 headerbidding

  1. download and run the node installer for windows: https://nodejs.org/en/download/
  2. Download and run the git installer: https://git-scm.com/download/win
  3. Open a terminal window and run npm install -g gulp
  4. Checkout the project using git. Open a terminal and run git clone https://github.com/prebid/Prebid.js.git
  5. Move into the directory of ${local_path}/Prebid.js created by git clone and run npm install and then gulp build
  6. Built prebid will reside in ${local_path}/Prebid.js/build/dist/prebid.js

mkendall07 avatar Nov 28 '16 22:11 mkendall07

1-2-3-4 worked perfectly. When I did 5 npm install I got error messages:

C:\Users>npm install -g gulp npm WARN deprecated [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue npm WARN deprecated [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue npm WARN deprecated [email protected]: graceful-fs v3.0.0 and before will fail o n node releases >= v7.0. Please update to graceful-fs@^4.0.0 as soon as possible . Use 'npm ls graceful-fs' to find it in the tree.

headerbidding avatar Nov 28 '16 22:11 headerbidding

It looks like you have an older version of node installed.

npm ERR! node v4.5.0

You should have a 6.x.x version. See here to update: http://stackoverflow.com/questions/18412129/how-do-i-update-node-and-npm-on-windows

mkendall07 avatar Nov 28 '16 22:11 mkendall07

The instructions were too complex. I went ahead and just installed from your link https://nodejs.org/en/download/ and I now have version 6

headerbidding avatar Nov 28 '16 22:11 headerbidding

STEP 3:

Microsoft Windows [Version 6.1.7601] Copyright (c) 2009 Microsoft Corporation. All rights reserved.

C:\windows\system32>npm install -g gulp npm WARN deprecated [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue npm WARN deprecated [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue npm WARN deprecated [email protected]: graceful-fs v3.0.0 and before will fail o n node releases >= v7.0. Please update to graceful-fs@^4.0.0 as soon as possible . Use 'npm ls graceful-fs' to find it in the tree. C:\Users\Hubert\AppData\Roaming\npm\gulp -> C:\Users\Hubert\AppData\Roaming\npm
node_modules\gulp\bin\gulp.js C:\Users\Hubert\AppData\Roaming\npm `-- [email protected]

C:\windows\system32>

headerbidding avatar Nov 28 '16 22:11 headerbidding

STEP 4: C:\Users\Hubert>git clone https://github.com/prebid/Prebid.js.git Cloning into 'Prebid.js'... remote: Counting objects: 4173, done. remote: Compressing objects: 100% (45/45), done. remote: Total 4173 (delta 19), reused 0 (delta 0), pack-reused 4127 eceiving obj Receiving objects: 100% (4173/4173), 1.67 MiB | 1.14 MiB/s, done.

Resolving deltas: 100% (2710/2710), done.

C:\Users\Hubert>

headerbidding avatar Nov 28 '16 22:11 headerbidding

Step 5: also worked, with just a few warnings

headerbidding avatar Nov 28 '16 22:11 headerbidding

Wow! I assume I now have a prebid.js with all the adapters! Cool! Now I have to figure out how to make one with selected adapters only ...

headerbidding avatar Nov 28 '16 22:11 headerbidding

Hmm. the prebid.js file generated is only 30kb. When I donload it from http://prebid.org/download.html with the selected adapters it is 50kb.

headerbidding avatar Nov 28 '16 22:11 headerbidding

Modify Prebid.js/adapters.json to list only the adapters you want to be built with and then run gulp build

mkendall07 avatar Nov 29 '16 16:11 mkendall07

Wow. It worked! I made my own 0.15.3-pre version !!!

But: I still get the Error: Object {} "ERROR: Prebid Error: no analytics adapter found in registry for ga." ""

I figured it out: I forgot to include "ga" in the "analytics" array in package.json.

headerbidding avatar Nov 29 '16 19:11 headerbidding

So I changed "analytics": [], to "analytics": "ga", but got an error when doing another gulp build:

headerbidding avatar Nov 29 '16 19:11 headerbidding

An array is expected, try "analytics": ["ga"]

protonate avatar Nov 29 '16 20:11 protonate

Thank you! It works now! Thanks to all for your help!

headerbidding avatar Nov 29 '16 20:11 headerbidding

@headerbidding Glad it's working.

@prebid/docs this ticket could be used as a starting point for more verbose dev help docs / getting starting with dev

mkendall07 avatar Nov 29 '16 20:11 mkendall07

Yes. Your instructions were great. I have never used npm or git and it was easy to follow!

@prebid/docs Adding screenshots of the CMD and GIT windows would make it even more foolproof.

headerbidding avatar Nov 29 '16 20:11 headerbidding