Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Octal escape sequences are not allowed in template strings

I'm building a desktop app using electron and vue, things went normal running the app in dev mode and building it untill the last building by running electron:build but I keep getting this error of Octal escape sequences.

I am pretty sure that it has to deal with the strict mode, but I tried to find the ocatal escapes but no chance, I tried to remove some useless dependencies the I added after the last successful build also didn't work


PS: the electron:serve works fine

err picture

enter image description here

background.js from Terser Octal escape sequences are not allowed in template strings [background.js:1026,68555]

ERROR Build failed with errors. npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! [email protected] electron:build: vue-cli-service electron:build npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the [email protected] electron:build script. npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

like image 252
hakim bhd Avatar asked May 08 '19 11:05

hakim bhd


2 Answers

The issue is in background.js. In lines 1026 and 68555, look for a template string with an octal sequence in it. Example:

console.log(`Octal sequences like \033 are not allowed here`)

You can revert the es6 template to a (regular) string instead:

console.log("Octal sequences like \033 are allowed here")

Or you might try a different, permitted encoding, e.g.,

console.log(`Sequences like \2264 are not allowed here`);
console.log(`But sequences like \u2264 are allowed`);
like image 181
Matt Simerson Avatar answered Oct 18 '22 04:10

Matt Simerson


Sorry this is a rather late response, but there is in fact a way to use octal escape sequences in template strings. You add the octal sequence using a normal string inside it. For example:

let myString = `foo ${"\033"} bar`

This is similar to adding the strings together:

let myString = `foo ` + "\003" + ` bar`
like image 1
SirFireball Avatar answered Oct 18 '22 04:10

SirFireball