Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mime dependency breaking changes #326

Open
valtlfelipe opened this issue Sep 13, 2017 · 11 comments
Open

mime dependency breaking changes #326

valtlfelipe opened this issue Sep 13, 2017 · 11 comments

Comments

@valtlfelipe
Copy link

node-mime has released a new version, which requires node>=6. And in package.json of knox requires mim in any version "mime": "*",.

My enviorment uses node 4, and this just broke my application.

Please merge #325.

See the stack trace.

/home/ubuntu/newfleet/app/node_modules/knox/node_modules/mime/Mime.js:5
class Mime {
^^^^^

SyntaxError: Block-scoped declarations (let, const, function, class) not yet supported outside strict mode
    at exports.runInThisContext (vm.js:53:16)
    at Module._compile (module.js:373:25)
    at Object.Module._extensions..js (module.js:416:10)
    at Module.load (module.js:343:32)
    at Function.Module._load (module.js:300:12)
    at Module.require (module.js:353:17)
    at require (internal/module.js:12:17)
    at Object.<anonymous> (/home/ubuntu/newfleet/app/node_modules/knox/node_modules/mime/index.js:1:76)
    at Module._compile (module.js:409:26)
    at Object.Module._extensions..js (module.js:416:10)
    at Module.load (module.js:343:32)
    at Function.Module._load (module.js:300:12)
    at Module.require (module.js:353:17)
    at require (internal/module.js:12:17)
    at Object.<anonymous> (/home/ubuntu/newfleet/app/node_modules/knox/lib/client.js:20:12)
    at Module._compile (module.js:409:26)
    at Object.Module._extensions..js (module.js:416:10)
    at Module.load (module.js:343:32)
    at Function.Module._load (module.js:300:12)
    at Module.require (module.js:353:17)
    at require (internal/module.js:12:17)
    at Object.<anonymous> (/home/ubuntu/newfleet/app/node_modules/knox/lib/index.js:13:28)
@acarl005
Copy link

Similar problem. We use Node 8 but instead we get a runtime error.

ERROR TypeError: mime.lookup is not a function
     at /app/node_modules/knox/lib/client.js:363:28
     at FSReqWrap.oncomplete (fs.js:153:5)

@tmoreno
Copy link

tmoreno commented Sep 14, 2017

I have the same problem that @valtlfelipe

@PyroSA
Copy link

PyroSA commented Sep 14, 2017

Same issue. Old 0.12.7 server got re-initialised this morning.

@PyroSA
Copy link

PyroSA commented Sep 14, 2017

Thanks @valtlfelipe & @neebz
You can temporarily use their fixed version of 0.9.2 by using:
"knox": "git://github.com/caremerge/knox.git#b1e031c209b3c17cab622a458e87728c1ee88cbd",
In your package.json

@dwjft
Copy link

dwjft commented Sep 14, 2017

It seems this package is no longer maintained.

I have created a clone with the fix here: https://www.npmjs.com/package/knox-s3

No other changes other than pinning the mime version.

@manuelxaguilar
Copy link

So there's no chance of getting this fixed? I'm not using Knox directly, I'm actually using Keystone, which has Knox as a dependency itself, so I keep getting this mime.lookup error. Any suggestions if this won't get fixed?

@valtlfelipe
Copy link
Author

@manuelxaguilar You will have to open an issue at Keystone, so they can change the konx dependency to use @dwjft fork for example 😞

@sedge
Copy link

sedge commented Oct 4, 2017

@manuelxaguilar @valtlfelipe You can also investigate npm shrinkwrap to prevent this sort of thing in the future.

@manuelxaguilar
Copy link

@valtlfelipe Yeah, I brought it up but they seem to take forever to reply... We'll see I guess.

@sedge I'm using Yarn on my project, which I believe doesn't work well with npm-shrinkwrap. I actually used resolutions to determine which version of Knox to use (I used @PyroSA fork) and it worked well on development, however it failed when deploying to Heroku because it wasn't recognizing git as a valid protocol. :/

@madsleejensen
Copy link

If you use yarn you can get around this issue by using https://yarnpkg.com/lang/en/docs/selective-version-resolutions/

// package.json { .... "resolutions": { "keystone/knox/mime": "1.4.0" } }

@jashmenn
Copy link

jashmenn commented Feb 6, 2019

Thanks @madsleejensen - that worked for me, though I was using knox via the s3-sync package, so my `"resolutions" looked like this:

    "resolutions": { "s3-sync/knox/mime": "1.4.0" } 

The key idea being, one needs to specify the path to mime via the packages they're using. (You can run yarn why mime to find yours.

gwest4 added a commit to onenorth/keystone that referenced this issue Feb 20, 2024
Knox has its own dependency, mime. Knox is no longer maintained and there is an issue with the way it defined its mime dependency in that it did not lock down mime’s version number. Just 2 months ago, mime updated to version 4.0, which no longer supports below Node 14. Our Keystone sites still run on Node 10 so this results in a runtime error (`SyntaxError: Unexpected identifier` on module export syntax) that can’t be worked around.

Keystone Classic fixed this by updating to a fork of knox called knox-s3, which specifies a version of mime but is otherwise the same. This commit applies the same fix.

Links:
Automattic/knox#326
https://github.com/broofa/mime/blob/main/README.md?plain=1#L21
https://github.com/keystonejs/keystone-classic/blob/master/package.json#L63
gwest4 added a commit to onenorth/keystone that referenced this issue Feb 20, 2024
Knox has its own dependency, mime. Knox is no longer maintained and there is an issue with the way it defined its mime dependency in that it did not lock down mime’s version number. Just 2 months ago, mime updated to version 4.0, which no longer supports below Node 14. Our Keystone sites still run on Node 10 so this results in a runtime error (`SyntaxError: Unexpected identifier` on module export syntax) that can’t be worked around.

Keystone Classic fixed this by updating to a fork of knox called knox-s3, which specifies a version of mime but is otherwise the same. This commit applies the same fix.

Links:
Automattic/knox#326
https://github.com/broofa/mime/blob/main/README.md?plain=1#L21
https://github.com/keystonejs/keystone-classic/blob/master/package.json#L63
gwest4 added a commit to onenorth/keystone-hosting that referenced this issue Feb 20, 2024
A similar commit was made in onenorth/keystone to fix this issue.

Knox has its own dependency, mime. Knox is no longer maintained and there is an issue with the way it defined its mime dependency in that it did not lock down mime’s version number. Just 2 months ago, mime updated to version 4.0, which no longer supports below Node 14. Our Keystone sites still run on Node 10 so this results in a runtime error (`SyntaxError: Unexpected identifier` on module export syntax) that can’t be worked around.

Keystone Classic fixed this by updating to a fork of knox called knox-s3, which specifies a version of mime but is otherwise the same. This commit applies the same fix.

Links:
Automattic/knox#326
https://github.com/broofa/mime/blob/main/README.md?plain=1#L21
https://github.com/keystonejs/keystone-classic/blob/master/package.json#L63
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

9 participants