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

images dont appear in exports - mime.getType is not a function #41

Closed
floswald opened this issue Sep 4, 2018 · 8 comments · Fixed by #42
Closed

images dont appear in exports - mime.getType is not a function #41

floswald opened this issue Sep 4, 2018 · 8 comments · Fixed by #42
Labels

Comments

@floswald
Copy link

floswald commented Sep 4, 2018

hi
i'm having trouble including images in exported presentations. if i do bs serve, i can see the image, if i do bs e i cannot. in the resulting html export, it says <img src="undefined">

screenshot 2018-09-04 08 10 23

here is my source code

```
title: My Presentation
class: animation-fade
layout: true

<!-- This slide will serve as the base layout for all your slides -->
.bottom-bar[
  {{title}}
]

---

class: impact

# {{title}}
## With a good subtitle :-)

---

# images

![](tree.jpg)

---

# The basics

## Getting started

Use [Markdown](https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet) to write your slides. Don't be afraid, it's really easy!

--

## Making points

Look how you can make *some* points:
--

- Create slides with your **favorite text editor**
--

- Focus on your **content**, not the tool
--

- You can finally be **productive**!

---

# There's more

## Syntax highlighting

You can also add `code` to your slides:
```html
<div class="impact">Some HTML code</div>
```

## CSS classes

You can use .alt[shortcut] syntax to apply .big[some style!]

...or just <span class="alt">HTML</span> if you prefer.

---

# And more...

## 12-column grid layout

Use to the included **grid layout** classes to split content easily:
.col-6[
  ### Left column

  - I'm on the left
  - It's neat!
]
.col-6[
  ### Right column

  - I'm on the right
  - I love it!
]

## Learn the tricks

See the [wiki](https://github.com/gnab/remark/wiki) to learn more of what you can do with .alt[Remark.js]
```
@floswald
Copy link
Author

floswald commented Sep 5, 2018

the error I get is this:

➜  testp bs e
0% exporting file 1/1mime.getType(...) is not a function
100% exporting file 1/1

@floswald
Copy link
Author

floswald commented Sep 5, 2018

I uninstalled and reinstalled 2 times with brew now, all seems fine. i still get the mime error. do i need to install the mime package separately? does it not download all dependencies? again, here is what im seeing:

➜  testp bs e
0% exporting file 1/1mime.getType(...) is not a function
100% exporting file 1/1
➜  testp node -v    
v10.9.0
➜  testp npm -v
6.4.1
➜  testp echo $NODE_MODULES

➜  testp echo $NODE_PATH   
/usr/local/lib/node_modules
➜  testp ls /usr/local/lib/node_modules
backslide decktape  npm

and here is the install output:

➜  ~ npm install -g decktape
/usr/local/bin/decktape -> /usr/local/lib/node_modules/decktape/decktape.js

> hummus@1.0.87 install /usr/local/lib/node_modules/decktape/node_modules/hummus
> node-pre-gyp install --fallback-to-build

[hummus] Success: "/usr/local/lib/node_modules/decktape/node_modules/hummus/binding/hummus.node" is installed via remote

> puppeteer@1.7.0 install /usr/local/lib/node_modules/decktape/node_modules/puppeteer
> node install.js

Downloading Chromium r579032 - 80.8 Mb [====================] 100% 0.0s 
Chromium downloaded to /usr/local/lib/node_modules/decktape/node_modules/puppeteer/.local-chromium/mac-579032
+ decktape@2.8.8
added 99 packages from 49 contributors in 23.848s
➜  ~ npm install -g backslide
/usr/local/bin/bs -> /usr/local/lib/node_modules/backslide/bin/bs

> hummus@1.0.87 install /usr/local/lib/node_modules/backslide/node_modules/decktape/node_modules/hummus
> node-pre-gyp install --fallback-to-build

[hummus] Success: "/usr/local/lib/node_modules/backslide/node_modules/decktape/node_modules/hummus/binding/hummus.node" is installed via remote

> puppeteer@1.7.0 install /usr/local/lib/node_modules/backslide/node_modules/decktape/node_modules/puppeteer
> node install.js

Downloading Chromium r579032 - 80.8 Mb [====================] 100% 0.0s 
Chromium downloaded to /usr/local/lib/node_modules/backslide/node_modules/decktape/node_modules/puppeteer/.local-chromium/mac-579032

> fsevents@1.2.4 install /usr/local/lib/node_modules/backslide/node_modules/fsevents
> node install

[fsevents] Success: "/usr/local/lib/node_modules/backslide/node_modules/fsevents/lib/binding/Release/node-v64-darwin-x64/fse.node" already installed
Pass --update-binary to reinstall or --build-from-source to recompile

> node-sass@4.9.3 install /usr/local/lib/node_modules/backslide/node_modules/node-sass
> node scripts/install.js

Downloading binary from https://github.com/sass/node-sass/releases/download/v4.9.3/darwin-x64-64_binding.node
Download complete ░⸩ ⠋ :
Binary saved to /usr/local/lib/node_modules/backslide/node_modules/node-sass/vendor/darwin-x64-64/binding.node
Caching binary to /Users/74097/.npm/node-sass/4.9.3/darwin-x64-64_binding.node

> node-sass@4.9.3 postinstall /usr/local/lib/node_modules/backslide/node_modules/node-sass
> node scripts/build.js

Binary found at /usr/local/lib/node_modules/backslide/node_modules/node-sass/vendor/darwin-x64-64/binding.node
Testing binary
Binary is fine
+ backslide@2.3.1
added 670 packages from 373 contributors in 36.78s

@floswald floswald changed the title images dont appear in exports images dont appear in exports - mime.getType is not a function Sep 5, 2018
@sinedied
Copy link
Owner

sinedied commented Sep 5, 2018

Seems strange as this issue is due to an older mime package being used.
Can you try?

npm rm -g backslide
npm cache clean --force
npm i -g backslide

Do you use any npm proxy by chance?

EDIT: BTW your install log show the decktape install, not backslide. And decktape is not needed anymore as a separate dependency as it's included with the main install.

@floswald
Copy link
Author

floswald commented Sep 5, 2018

ok - thanks for that. i did as you said:

➜  testp npm rm -g backslide
npm cache clean --force
npm i -g backslide
removed 670 packages in 3.579s
npm WARN using --force I sure hope you know what you are doing.
/usr/local/bin/bs -> /usr/local/lib/node_modules/backslide/bin/bs

> hummus@1.0.87 install /usr/local/lib/node_modules/backslide/node_modules/decktape/node_modules/hummus
> node-pre-gyp install --fallback-to-build

[hummus] Success: "/usr/local/lib/node_modules/backslide/node_modules/decktape/node_modules/hummus/binding/hummus.node" is installed via remote

> puppeteer@1.7.0 install /usr/local/lib/node_modules/backslide/node_modules/decktape/node_modules/puppeteer
> node install.js

Downloading Chromium r579032 - 80.8 Mb [====================] 100% 0.0s 
Chromium downloaded to /usr/local/lib/node_modules/backslide/node_modules/decktape/node_modules/puppeteer/.local-chromium/mac-579032

> fsevents@1.2.4 install /usr/local/lib/node_modules/backslide/node_modules/fsevents
> node install

[fsevents] Success: "/usr/local/lib/node_modules/backslide/node_modules/fsevents/lib/binding/Release/node-v64-darwin-x64/fse.node" already installed
Pass --update-binary to reinstall or --build-from-source to recompile

> node-sass@4.9.3 install /usr/local/lib/node_modules/backslide/node_modules/node-sass
> node scripts/install.js

Cached binary found at /Users/74097/.npm/node-sass/4.9.3/darwin-x64-64_binding.node

> node-sass@4.9.3 postinstall /usr/local/lib/node_modules/backslide/node_modules/node-sass
> node scripts/build.js

Binary found at /usr/local/lib/node_modules/backslide/node_modules/node-sass/vendor/darwin-x64-64/binding.node
Testing binary
Binary is fine
+ backslide@2.3.1
added 670 packages from 373 contributors in 29.98s
➜  testp bs e
0% exporting file 1/1mime.getType(...) is not a function
100% exporting file 1/1

also removed decktape as a separate installation. i know this is very weird. is this expected:

➜  testp node
> mime = require('mime')
Error: Cannot find module 'mime'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:581:15)
    at Function.Module._load (internal/modules/cjs/loader.js:507:25)
    at Module.require (internal/modules/cjs/loader.js:637:17)
    at require (internal/modules/cjs/helpers.js:20:18)

i dont' use any npm proxy that I would know of - just installed from brew. how could i check?

@sinedied
Copy link
Owner

sinedied commented Sep 11, 2018

Just released 2.3.2 that fixes the issue thanks to @xemoka, sorry the mistake I'm lacking some sleep because of my newborn 👶

@floswald
Copy link
Author

wait - did you actually ever try to reproduce this? reproduce as in typing bs e on your computer?
seeing #42 means this cannot have worked, not on my machine and not on any other one.
I wasted a good 3 hours with this issue, messing around with different ways to install node and all that.
this is a great library, but that was a bit so-so.
I'll forgive you because of the baby.
get some sleep!! 😄
It works like a charm now! 🎉

@sinedied sinedied added the bug label Sep 11, 2018
@sinedied
Copy link
Owner

Yes my bad, I quickly tested on my home laptop, but forgot to switch to the master branch 😱
And usually I only merge new code through PR so the CI catches issues like this, but this one was introduced while attempting to quickly fix #37 and didn't went through a PR (shame on me again).
You're definitely right, issues like that should not happen, I'm sorry for the time you lost...
Thankfully I'll be on vacation soon, I hope to catch up some sleep then 😴

@floswald
Copy link
Author

floswald commented Sep 11, 2018 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants