alanshaw / alanshaw/markdown-pdf

Doesn't work: `internal/validators.js:125` `TypeError [ERR_INVALID_ARG_TYPE]`

Open
#194 6 comments 21 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
2.9k
Forks
253
PR merge metrics
No merged PRs in 30d

Description

I'm on Ubuntu 20.04.

I saw this answer: https://superuser.com/a/902150/425838

Tried to install:

```bash
$ npm install -g markdown-pdf
npm WARN deprecated phantomjs-prebuilt@2.1.16: this package is now deprecated
npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated har-validator@5.1.5: this library is no longer supported
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules
npm ERR! code EACCES
npm ERR! syscall access
npm ERR! path /usr/local/lib/node_modules
npm ERR! errno -13
npm ERR! Error: EACCES: permission denied, access '/usr/local/lib/node_modules'
npm ERR! { [Error: EACCES: permission denied, access '/usr/local/lib/node_modules']
npm ERR! stack:
npm ERR! 'Error: EACCES: permission denied, access \'/usr/local/lib/node_modules\'',
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'access',
npm ERR! path: '/usr/local/lib/node_modules' }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It is likely you do not have the permissions to access this file as the current user
npm ERR!
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator.

npm ERR! A complete log of this run can be found in:
npm ERR! /home/gabriel/.npm/_logs/2020-10-08T06_13_24_844Z-debug.log
```

Failed, so I used `sudo`:

It seems to have worked:

```bash
$ sudo npm install -g markdown-pdf
[sudo] password for gabriel:
npm WARN deprecated phantomjs-prebuilt@2.1.16: this package is now deprecated
npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated har-validator@5.1.5: this library is no longer supported
/usr/local/bin/markdown-pdf -> /usr/local/lib/node_modules/markdown-pdf/bin/markdown-pdf

> phantomjs-prebuilt@2.1.16 install /usr/local/lib/node_modules/markdown-pdf/node_modules/phantomjs-prebuilt
> node install.js
```

I tried to use it. Failed!

```bash
$ markdown-pdf test.md
internal/validators.js:125
throw new ERR_INVALID_ARG_TYPE(name, 'string', value);
^

TypeError [ERR_INVALID_ARG_TYPE]: The "file" argument must be of type string. Received type object
at validateString (internal/validators.js:125:11)
at normalizeSpawnArguments (child_process.js:411:3)
at spawn (child_process.js:545:16)
at Object.execFile (child_process.js:221:15)
at WriteStream. (/usr/local/lib/node_modules/markdown-pdf/index.js:117:22)
at WriteStream.emit (events.js:203:15)
at finishMaybe (_stream_writable.js:646:14)
at stream._final (_stream_writable.js:624:5)
at WriteStream._final (internal/fs/streams.js:268:3)
at callFinal (_stream_writable.js:617:10)
```

Here's my **test.md** file I was trying to convert to pdf:

Snippet from: https://github.com/ElectricRCAircraftGuy/eRCaGuy_hello_world/blob/master/markdown/github_readme_center_and_align_images.md

## 1.1. Align images left, right, or centered, with NO WORD WRAP:

This:

```html
**Align left:**



**Align center:**



**Align right:**




```

Produces this:

**Align left:**



**Align center:**



**Align right:**



If you'd like to set the text itself to left, center, or right, you can include the text inside the `

` element as well, as regular HTML, like this:

```html


This text is also aligned to the right.



```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.