I'm trying to build a blog using Hugo. Every time I run the hugo command, I get this error
ERROR 2021/06/22 18:57:50 JSON parse error: expected comma character
or an array or object ending on line 52 and column 40
12: {
^
Total in 145 ms
Error: Error building site: failed to render pages: JSON parse error:
expected comma character or an array or object ending on line 52 and column 40
12: {
^
I suspect my project directory structure to be the problem but I'm open to more questions about the situation.
My project directory structure looks like
root-folder
--content
--posts
--my-first-post.md
--posts-again
--my-second-post.md
--my-third-post.md
--my-fourth-post.md
and all markdown files contain exactly the following
---
title: "Project"
date: 2021-06-22T18:09:26+01:00
draft: false
---
This is a post
When draft is set to true, I don't get the error when I run the hugo command. The error comes up when draft for any of the files in posts or posts-again is set to false
I have searched every file for a line 52 that I can understand but I cannot find any.
Where could this error be coming from and how can I resolve it?
hugo serve and hugo serve -D work fine, but hugo doesn't
hugo-PaperMod is missing a comma in a JSON block in layouts/partials/templates/schema_json.html
I got this error and just pushed up a PR to fix it
https://github.com/adityatelange/hugo-PaperMod/pull/614
this may be your issue
Issue is baseurl set to "/" in config.toml.
Change it to "" and try
Related
Guyz getting this error i have added pdf.js file also and i'm upgrading node version that time i have got this error if anyone know please let me know
Failed to compile.
./node_modules/pdfjs-dist/build/pdf.js 3042:46
Module parse failed: Unexpected token (3042:46)
File was processed with these loaders:
./node_modules/babel-loader/lib/index.js
You may need an additional loader to handle the result of these loaders.
| key: "getJSActions",
| value: function getJSActions() {
return this._jsActionsPromise ||= this._transport.getPageJSActions(this._pageIndex);
| }
| }, {
It's a compile error. Node said "you need an additional loader to handle this issue" which means while you update you node, something happens in one of your loader file. You should re-install "the issue loader" and then run it again. Are you building your app with CRA template? if so, you should re-install CRA template again and then move all files into the new project folder and run it.
I hope you find a solution! :D
I am getting below error in Laravel Angularjs Application
Error: Expecting a token named "token" but instead got: "\nDeprecated: Automatically populating $HTTP_RAW_POST_DATA is
deprecated and will be removed in a future version. To avoid this
warning set 'always_populate_raw_post_data' to '-1' in php.ini and use
the php://input stream instead. in Unknown on line 0\n\nWarning: Cannot modify header information - headers
already sent in Unknown on line 0\n
i changed 'always_populate_raw_post_data' to '-1' this into 0,1 also command still same error how to fix that
I am trying to show a static pdf in React app. I have tried a lot of packages:
react-pdf
react-pdf-js
react-pdf-js-infinite
simple-react-pdf
pdfjs-dist
react-pdf-pages
They often say that we can use the URL, or pdf file for the props for the PDF component easily, but I cannot use either.
I had two main errors.
As I want to use myPDF for the props for the component, I write this:
import myPDF from 'path/to/pdf_file';
then, render_some_component pdf:{myPDF}
Here is the error:
ModuleParseError in
Module parse failed: Unexpected token (1:0)
You may need an appropriate loader to handle this file type.
(Source code omitted for this binary file)
(When I comment that line, this kind of error disappears)
I used the file-loader in webpack config, I have tried many different ways but failed.
I use the pdf file directly for the props like this:
render_some_component pdf:{'path/to/pdf_file'}
In the Console:
Warning: Setting up fake worker.
11:23:55.962 pdf.worker.js:349 Warning: Ignoring invalid character "33" in hex string
11:23:55.963 pdf.worker.js:349 Warning: Ignoring invalid character "79" in hex string
...
There are a lot of 'Ignoring invalid character' like that and it always ends with:
localhost/:1 Uncaught (in promise) InvalidPDFException {name: "InvalidPDFException", message: "Invalid PDF structure"}
In the Network, Headers, I see:
Request URL:http://localhost:3000/myPdfFile.pdf
Request Method:GET
Status Code:200 OK
Remote Address:127.0.0.1:3000
but In the Network, Response, I see just the HTML layout.
I think the pdf file is loaded correctly but the package cannot recognize its PDF structure.
Except that two main errors, I had another error related to the Worker used in the packages but I don't know how to fix it:
Uncaught DOMException: Failed to construct 'Worker'
(This is something relates to Chrome as people say Chrome does not allow Worker in the local server)
Any help is highly appreciated as I am stuck in this in 4 days already.
Can you pleas clarify what you main task is?
If I understood it right you want to display a PDF file that already exists in a part of your application? You don't want to create a new PDF with JavaScript.
If you want to just show a PDF have you tried to use iframe?
Something like this:
<iframe
title="file"
style={{ width: '100%', height: '100%' }}
src={downloadURL}
/>
You ca use here also relative paths to the file from the location where your Component is or use full URLs to the file.
I am unable to connect to a project on Google Cloud using the cloud SDK. I want to upload file on my instance using SDK. The error I am getting is:
You are now logged in as [ishanatech#gmail.com].
Your current project is [Trial-2015-1]. You can change this setting by running:
$ gcloud config set project PROJECT
C:\Program Files\Google\Cloud SDK>gcloud compute instances list
NAME ZONE MACHINE_TYPE INTERNAL_IP EXTERNAL_IP STATUS
ERROR: (gcloud.compute.instances.list) Some requests did not succeed:
- Invalid value 'Trial-2015-1'. Values must match the following regular expression: '(?:(?:[-a-z0-9]{1,63}\.)*(?:[a-z](
?:[-a-z0-9]{0,61}[a-z0-9])?):)?(?:[0-9]{1,19}|(?:[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?))'
C:\Program Files\Google\Cloud SDK>gcloud compute instances create instance-2 --image centos-6 --zone uscentral1-a
NAME ZONE MACHINE_TYPE INTERNAL_IP EXTERNAL_IP STATUS
ERROR: (gcloud.compute.instances.create) Failed to find image for alias [centos-6] in public image project [centos-cloud
]. Try specifying a different image using [--image].
- Invalid value 'Trial-2015-1'. Values must match the following regular expression: '(?:(?:[-a-z0-9]{1,63}\.)*(?:[a-z](
?:[-a-z0-9]{0,61}[a-z0-9])?):)?(?:[0-9]{1,19}|(?:[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?))'
C:\Program Files\Google\Cloud SDK>gcloud compute instances create instance-2 --image opensuse-13 --zone uscentral1-a
NAME ZONE MACHINE_TYPE INTERNAL_IP EXTERNAL_IP STATUS
ERROR: (gcloud.compute.instances.create) Failed to find image for alias [opensuse-13] in public image project [opensuse-
cloud]. Try specifying a different image using [--image].
- Invalid value 'Trial-2015-1'. Values must match the following regular expression: '(?:(?:[-a-z0-9]{1,63}\.)*(?:[a-z](
?:[-a-z0-9]{0,61}[a-z0-9])?):)?(?:[0-9]{1,19}|(?:[a-z](?:[-a-z0-9]{0,61}[a-z0-9])?))'
If you look carefully at the complex RE the error message displays:
'(?:(?:[-a-z0-9]{1,63}\.)*(?:[a-z](
?:[-a-z0-9]{0,61}[a-z0-9])?):)?(?:[0-9]{1,19}|(?:a-z?))'
you'll spot that all the letters there are lowercase -- always carefully expressed as a-z.
Trial-2015-1 starts with an uppercase letter, thus it's not deemed a valid project name.
Are you sure that your project isn't actually named trial-2015-1, with a leading lowercase initial...?
i am getting the below error while creating Bastion sever using terraform script
Error creating instance: googleapi: Error 400: Invalid value for field 'resource.name': 'Bastion-server'. Must be a match of regex '(?:a-z?)', invalid
I`m trying to create a page that read the metadata of an image and allow user to edit it and save it to the same image.
After searching the internet I have found exiftool as the solution but I can make it work only as a command line not as a library in the page.
I have this code:
eval('$metadata=' . exiftool.exe -php -q $imagePath);
foreach ($metadata[0] as $key => $value) {
if ($metadata[0][$key]!=$_POST[$key]){
if ($_POST[$key]=="") $_POST[$key]=" "; //if metadata is not set, than create an empty metadata
eval('$metadata=' . exiftool.exe "-$key=$_POST[$key]" $imagePath);
}
}
and I`m getting this error:
Parse error: syntax error, unexpected 'image' (T_STRING) in E:\xampp\htdocs\imgdata\index.php(30) : eval()'d code on line 1
I tried to replace the ` with other like " and ' but no luck.
What do I miss?
Any better idea on how to do it?
Thanks
I had the same problem, but using Centos OS, and found a solution here:
'command not found' error when using subprocess in apache
Might not work for Windows but worth a look. Basically the answer suggests specifying the full exiftool path rather than simply exiftool.exe.
If that doesn't help then have a look for errors in the Apache Error Log File.