BUG - error loading application based on pt.javascript.info repository
jonnathan-ls opened this issue · 2 comments
🐞 Bug:
ERROR tutorialTree
🎯 Context
Execution of the server
project locally to test the website translation initiative into Portuguese
💣 Problem
The ./edit pt
command to load the application ends up failing, as shown in the following log:
♨️ server git:(master) ✗ ./edit pt
[23:47:13] Using gulpfile ~/Desktop/desktop/javascript-info/server/gulpfile.js
[23:47:13] Starting 'edit'...
[23:47:13] Starting 'webpack'...
[23:47:13] Starting 'engine:koa:tutorial:importWatch'...
[23:47:13] Starting 'livereload'...
[23:47:13] Starting 'server'...
... LOG OMITTED ...
02:47:25.750Z ERROR tutorialTree:
Dupe entry Task {
title: 'Type conversions',
slug: 'primitive-conversions-questions',
githubPath: '/1-js/02-first-steps/08-operators/3-primitive-conversions-questions',
weight: 3,
libs: [],
importance: 5,
content: '\n' +
'\n' +
'What are results of these expressions?\n' +
'\n' +
'```js no-beautify\n' +
'"" + 1 + 0\n' +
'"" - 1 + 0\n' +
'true + false\n' +
'6 / "3"\n' +
'"2" * "3"\n' +
'4 + 5 + "px"\n' +
'"$" + 4 + 5\n' +
'"4" - 2\n' +
'"4px" - 2\n' +
'" -9 " + 5\n' +
'" -9 " - 5\n' +
'null + 1\n' +
'undefined + 1\n' +
'" \\t \\n" - 2\n' +
'```\n' +
'\n' +
'Think well, write down and then compare with the answer.',
solution: '```js no-beautify\n' +
'"" + 1 + 0 = "10" // (1)\n' +
'"" - 1 + 0 = -1 // (2)\n' +
'true + false = 1\n' +
'6 / "3" = 2\n' +
'"2" * "3" = 6\n' +
'4 + 5 + "px" = "9px"\n' +
'"$" + 4 + 5 = "$45"\n' +
'"4" - 2 = 2\n' +
'"4px" - 2 = NaN\n' +
'" -9 " + 5 = " -9 5" // (3)\n' +
'" -9 " - 5 = -14 // (4)\n' +
'null + 1 = 1 // (5)\n' +
'undefined + 1 = NaN // (6)\n' +
'" \\t \\n" - 2 = -2 // (7)\n' +
'```\n' +
'\n' +
'1. The addition with a string `"" + 1` converts `1` to a string: `"" + 1 = "1"`, and then we have `"1" + 0`, the same rule is applied.\n' +
'2. The subtraction `-` (like most math operations) only works with numbers, it converts an empty string `""` to `0`.\n' +
'3. The addition with a string appends the number `5` to the string.\n' +
'4. The subtraction always converts to numbers, so it makes `" -9 "` a number `-9` (ignoring spaces around it).\n' +
'5. `null` becomes `0` after the numeric conversion.\n' +
'6. `undefined` becomes `NaN` after the numeric conversion.\n' +
'7. Space characters, are trimmed off string start and end when a string is converted to a number. Here the whole string consists of space characters, such as `\\t`, `\\n` and a "regular" space between them. So, similarly to an empty string, it becomes `0`.',
parent: 'operators',
version: 1
}
[23:47:25] 'engine:koa:tutorial:importWatch' errored after 13 s
[23:47:25] Error: Already exists an entry with slug:primitive-conversions-questions
at TutorialTree.add (/Users/t719516/Desktop/desktop/javascript-info/server/modules/engine/koa/tutorial/models/tutorialTree.js:140:13)
at TutorialImporter.syncTask (/Users/t719516/Desktop/desktop/javascript-info/server/modules/engine/koa/tutorial/lib/tutorialImporter.js:354:15)
at TutorialImporter.syncArticle (/Users/t719516/Desktop/desktop/javascript-info/server/modules/engine/koa/tutorial/lib/tutorialImporter.js:242:20)
at runMicrotasks (<anonymous>)
at processTicksAndRejections (internal/process/task_queues.js:93:5)
at async TutorialImporter.syncFolder (/Users/t719516/Desktop/desktop/javascript-info/server/modules/engine/koa/tutorial/lib/tutorialImporter.js:152:9)
at async TutorialImporter.syncFolder (/Users/t719516/Desktop/desktop/javascript-info/server/modules/engine/koa/tutorial/lib/tutorialImporter.js:150:9)
at async TutorialImporter.sync (/Users/t719516/Desktop/desktop/javascript-info/server/modules/engine/koa/tutorial/lib/tutorialImporter.js:87:5)
at async module.exports (/Users/t719516/Desktop/desktop/javascript-info/server/modules/engine/koa/tutorial/tasks/importWatch.js:31:5)
[23:47:25] 'edit' errored after 13 s
🔍 Reason
Not identified.
✅ Expected
The expected would be for the application to load based on the desired language repository as in en
.
🛠️ Solution
Not identified.
🌍 Environmentl
Node
: 14.16.1Npm
: 6.14.12
🗳️ Suggestion
If there is any necessary step to load a repo from another language, it would be relevant to document in the README file how to proceed.
🏷️ Labels
~Bug ~Language ~Server ~Repo
The problem occurs because of reading duplicate content.
Currently, master
contemplates exercise in the context of two articles “type conversions” and “operators”. By eliminating the duplicate contents of the repository, it was possible to load the application to test the translation of the repository locally.
I apologize for the open issue.
After identifying the problem, it is clear to see that the error occurs due to duplicate contents in the PT repository (https://github.com/javascript-tutorial/pt.javascript.info), so I understand that the problems must be corrected in the repository of the documentation, and not in this “server” repository.