thlorenz / browserify-shim

📩 Makes CommonJS incompatible files browserifyable.
MIT License
934 stars 87 forks source link

npm@3 shrinkwrap --dev error #222

Closed Joseph7451797 closed 7 years ago

Joseph7451797 commented 7 years ago

I have read this #196, and still have a question.

I use npm@3 and encountered an error while using npm shrinkwrap --dev. Here is my output of npm ls:

├─┬ videojs-contrib-hls@3.6.10
│ ├─┬ aes-decrypter@1.0.3
│ │ └── pkcs7@0.2.3
│ ├── global@4.3.1
│ ├── m3u8-parser@1.2.0
│ ├─┬ mux.js@3.0.2
│ │ ├── UNMET PEER DEPENDENCY browserify@>= 2.3.0 < 14
│ │ └─┬ browserify-shim@3.8.12
│ │   ├─┬ exposify@0.4.3
│ │   │ ├─┬ globo@1.0.2
│ │   │ │ ├─┬ accessory@1.0.1
│ │   │ │ │ └── dot-parts@1.0.1
│ │   │ │ ├── is-defined@1.0.0
│ │   │ │ └── ternary@1.0.0
│ │   │ ├── has-require@1.1.0
│ │   │ ├─┬ replace-requires@1.0.3
│ │   │ │ ├─┬ detective@4.1.1
│ │   │ │ │ ├── acorn@1.2.2
│ │   │ │ │ ├── defined@1.0.0
│ │   │ │ │ └─┬ escodegen@1.8.1
│ │   │ │ │   ├── esprima@2.7.3
│ │   │ │ │   ├── estraverse@1.9.3
│ │   │ │ │   ├── esutils@2.0.2
│ │   │ │ │   └─┬ optionator@0.8.2
│ │   │ │ │     ├── deep-is@0.1.3
│ │   │ │ │     ├── fast-levenshtein@2.0.5
│ │   │ │ │     ├── levn@0.3.0
│ │   │ │ │     ├── prelude-ls@1.1.2
│ │   │ │ │     ├── type-check@0.3.2
│ │   │ │ │     └── wordwrap@1.0.0
│ │   │ │ ├── has-require@1.2.2
│ │   │ │ └── patch-text@1.0.2
│ │   │ ├─┬ through2@0.4.2
│ │   │ │ └─┬ xtend@2.1.2
│ │   │ │   └── object-keys@0.4.0
│ │   │ └─┬ transformify@0.1.2
│ │   │   └── readable-stream@1.1.14
│ │   ├─┬ mothership@0.2.0
│ │   │ └── find-parent-dir@0.3.0
│ │   ├─┬ rename-function-calls@0.1.1
│ │   │ └─┬ detective@3.1.0
│ │   │   ├─┬ escodegen@1.1.0
│ │   │   │ ├── esprima@1.0.4
│ │   │   │ ├── estraverse@1.5.1
│ │   │   │ ├── esutils@1.0.0
│ │   │   │ └── source-map@0.1.43
│ │   │   └── esprima-fb@3001.1.0-dev-harmony-fb
│ │   └── resolve@0.6.3
│ └─┬ videojs-contrib-media-sources@4.1.0
│   └── webworkify@1.0.2
...
npm ERR! peer dep missing: browserify@>= 2.3.0 < 14, required by browserify-shim@3.8.12

I know in npm@3, npm doesn't install peerdependencies, but npm shrinkwrap do read peerdependencies setting and return error. Here is my question: is it possible to add 'browserify' to 'dependencies'?

bendrucker commented 7 years ago

Browserify is not a dependency. It's a peer dependency. Browserify calls browserify-shim, not the other way around. Why don't you have it installed?

Joseph7451797 commented 7 years ago

@bendrucker, I appreciate your reply.

In my case, I use videojs-contrib-hls@3.6.10 as a dependency, and videojs-contrib-hls@3.6.10 uses mux.js, and mux.js uses browserify-shim@3.8.12. Actually I didn't add browserify and browserify-shim to my project package.json because I dont't need them.

It seems that mux.js should add 'browserify' to its 'dependencies'.(Well, I am not pretty sure...)

I am not familiar with browserify and browserify-shim, this time I'll manually add 'browserify' to my project package.json to solve this problem.

bendrucker commented 7 years ago

Sounds like mux.js expects to be built with browserify. Either way you can add browserify to your dependencies.