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

Underdog media spec requires "qs" module not listed in dependencies

Open dmitriyshashkin opened this issue 10 years ago • 3 comments

import {parse as parseQuery} from 'qs';

produces:

Uncaught Error: Cannot find module "qs" at /prebid/test/spec/adapters/underdogmedia_spec.js:59

dmitriyshashkin avatar Aug 11 '16 12:08 dmitriyshashkin

Not seeing this error myself or in the travis-ci build. Can you let me know your environment details (OS, node version etc).

mkendall07 avatar Aug 11 '16 15:08 mkendall07

npm 2.15.8 node v4.4.7 os Fedora 24

I've thought that any package used in the projects must be listed as a dependency. "qs" is used but not listed. You might not experience the problem because you have "qs" installed locally or globally.

dmitriyshashkin avatar Aug 12 '16 15:08 dmitriyshashkin

This error is due to the way npm3 resolves dependencies differently than npm2. Even though qs isn't listed in Prebid's package.json, it is a nested dependency of other modules, and that gets picked up when building under npm3 but not npm2. Regardless, modules that are directly required should definitely be listed in package.json rather than relying on nested dependencies.

In underdogmedia_spec.js, the qs module, and the url module directly above it, don't look like they are actually being used anywhere and could be removed to avoid any errors under either version of npm. Pinging the submitter of that commit @ojotoxy for thoughts on removing those imports.

matthewlane avatar Aug 12 '16 16:08 matthewlane