Receiving this error when importing a file. It looks like the issue is isolated to Linux
error: Uncaught AssertionError: Unexpected skip of the emit.
at Object.assert ($deno$/util.ts:33:11)
at compile ($deno$/compiler.ts:1170:7)
at tsCompilerOnMessage ($deno$/compiler.ts:1338:22)
at workerMessageRecvCallback ($deno$/runtime_worker.ts:72:33)
at file:///mydir/__anonymous__:1:1
Code to reproduce this error on Linux:
import Dex from "https://deno.land/x/dex/mod.ts";
Will look into it further and see if I can isolate the bug a bit.
Here's a more isolated example. I took a module I wrote about a month ago that performs base64 encoding, removed any external modules from it (was only using the path module prior), and then tried to import it and run it, and it throw the above error:
mod.ts
/**
* Encodes a Uint8Array into a base64 string
*
* @private
*
* @param {any} uint8arr a Uint8Array
* @returns {string} a base64 encoded string
*/
function _encodeU8intToBase64String(uint8arr: any) : string {
const CHUNK_SIZE = 0x8000;
const charArray: string[] = [];
for (let i = 0; i < uint8arr.length; i += CHUNK_SIZE) {
charArray.push(String.fromCharCode.apply(null, uint8arr.subarray(i, i + CHUNK_SIZE)));
}
return btoa(charArray.join(""));
}
/**
* Converts a string to a Uint8Array
*
* @private
*
* @param {string} str a string
* @returns {Uint8Array} a Uint8Array from the string
*/
function _convertStringToUint8(str: string) : Uint8Array {
return new Uint8Array(new TextEncoder().encode(str))
}
/**
* Decodes a UInt8Array that contains base64 data into a base64 decoded string
*
* @private
*
* @param {Uint8Array} bytes a Uint8Array that contains base64 encoded data
* @returns {string} an base64 unencoded string
*/
function _decodeBase64Bytes(bytes: Uint8Array) : string {
return new TextDecoder().decode(Uint8Array.from(atob(new TextDecoder().decode(bytes)), c => c.charCodeAt(0)))
}
/**
* Decodes a Uint8Array that contains base64 data into a base64 decoded Uint8Array
*
* @private
*
* @param {Uint8Array} bytes a Uint8Array that contains base64 encoded data
* @returns {Uint8Array} an base64 unencoded Uint8Array
*/
function _decodeBase64BytesToUint8(bytes: Uint8Array) : Uint8Array {
return Uint8Array.from(atob(new TextDecoder().decode(bytes)), c => c.charCodeAt(0));
}
/**
* This class provides an easy interface to perform base64 encoding on strings
* and files.
*/
export class Base64 {
private bytes: Uint8Array;
private mime: string;
private isBase64Encoded: boolean;
public constructor(data: any) {
this.bytes = data.bytes;
this.mime = data.mime;
this.isBase64Encoded = data.isBase64Encoded;
}
/**
* Creates a Base64 object from a string
*
* @public
* @static
*
* @param {string} unencodedString a string that will be base64 encoded
* @returns {Base64} a Base64 object
*/
public static fromString(unencodedString: string) : Base64 {
return new Base64({
bytes: _convertStringToUint8(unencodedString),
mime: null,
isBase64Encoded: false,
});
}
/**
* Creates a Base64 object from an already base64 encoded string
*
* @public
* @static
*
* @param {string} encodedString a string that is already base64 encoded
* @returns {Base64} a Base64 object
*/
public static fromBase64String(encodedString: string) : Base64 {
return new Base64({
bytes: _convertStringToUint8(encodedString),
mime: null,
isBase64Encoded: true,
});
}
/**
* Creates a Base64 object from a Uint8Array
*
* @public
* @static
*
* @param {Uint8Array} uint8arr a Uint8Array that will be base64 encoded
* @returns {Base64} a Base64 object
*/
public static fromUint8Array(uint8arr: Uint8Array) : Base64 {
return new Base64({
bytes: uint8arr,
mime: null,
isBase64Encoded: false,
});
}
/**
* Creates a Base64 object from a base64 encoded Uint8Array
*
* @public
* @static
*
* @param {Uint8Array} uint8arr a Uint8Array that contains base64 encoded data
* @returns {Base64} a Base64 object
*/
public static fromBase64Uint8Array(uint8arr: Uint8Array) : Base64 {
return new Base64({
bytes: uint8arr,
mime: null,
isBase64Encoded: true,
});
}
/**
* Returns the base64 encoded string from the Base64 object
*
* @public
*
* @returns {Base64} a base64 encoded string
*/
public toString() : string {
if (this.isBase64Encoded) {
return _decodeBase64Bytes(this.bytes);
} else {
return _encodeU8intToBase64String(this.bytes);
}
}
/**
* Returns the base64 encoded string from the Base64 object, with the
* inclusion of the MIME type if the Base64 object was created from a file
* (and if not created from a file, works the same as the .toString() method)
*
* @public
*
* @returns {string} a base64 encoded string with MIME type included when from a file
*/
public toStringWithMime() : string {
if (this.mime) {
if (this.isBase64Encoded) {
return _decodeBase64Bytes(this.bytes);
} else {
return this.mime + _encodeU8intToBase64String(this.bytes);
}
} else {
if (this.isBase64Encoded) {
return _decodeBase64Bytes(this.bytes);
} else {
return _encodeU8intToBase64String(this.bytes);
}
}
}
}
test.js
import { Base64 } from "./mod.ts";
console.log(Base64.fromString("hello world").toString());
I reproduced this here: https://github.com/denoland/deno/issues/5982#issuecomment-638446932. I put it in that issue because it seems connected.
I can reproduce on windows
import { sprintf } from "https://deno.land/std/fmt/printf.ts";
> deno run example.js
Compile file:///D:/Projects/deno/example.js
error: Uncaught AssertionError: Unexpected skip of the emit.
at Object.assert ($deno$/util.ts:33:11)
at compile ($deno$/compiler.ts:1170:7)
at tsCompilerOnMessage ($deno$/compiler.ts:1338:22)
at workerMessageRecvCallback ($deno$/runtime_worker.ts:72:33)
at file:///D:/Projects/deno/__anonymous__:1:1
Getting the same on mac:
Compile file:///Users/edgaras/Documents/Sites/deno-sandbox/app.js
error: Uncaught AssertionError: Unexpected skip of the emit.
at Object.assert ($deno$/util.ts:33:11)
at compile ($deno$/compiler.ts:1170:7)
at tsCompilerOnMessage ($deno$/compiler.ts:1338:22)
at workerMessageRecvCallback ($deno$/runtime_worker.ts:72:33)
at file:///Users/edgaras/Documents/Sites/deno-sandbox/__anonymous__:1:1
This is the minimum error code. (save as "test.js", and "deno run test.js")
import { exp } from "https://taisukef.github.io/denolib/test_mod.ts";
test_mod.ts is the just bellow
export const exp = {};
import ts from js -- NG
import ts from mjs -- OK
import ts from cjs -- OK
import ts from ts -- OK
import mjs from js-- OK
import ts (local) from js -- OK
1.0.3 -- OK
1.0.4 -- NG
1.0.5 -- NG
Update: I'm looking into this issue and found root cause. Fix will be released in Deno 1.1 in a few days.
Im also geting this error on windows
Compile file:///D:/Deno/diplodocus/app.js
error: Uncaught AssertionError: Unexpected skip of the emit.
at Object.assert ($deno$/util.ts:33:11)
at compile ($deno$/compiler.ts:1170:7)
at tsCompilerOnMessage ($deno$/compiler.ts:1338:22)
at workerMessageRecvCallback ($deno$/runtime_worker.ts:72:33)
at file:///D:/Deno/diplodocus/__anonymous__:1:1
error: Uncaught AssertionError: Unexpected skip of the emit.
at Object.assert ($deno$/util.ts:33:11)
at compile ($deno$/compiler.ts:1170:7)
at tsCompilerOnMessage ($deno$/compiler.ts:1338:22)
at workerMessageRecvCallback ($deno$/runtime_worker.ts:72:33)
at file:///C:/Project/Deno/denoreact/__anonymous__:1:1
Facing same issue for "https://deno.land/x/[email protected]/mod.ts"
same in mac
$ deno run deno2.js
Download https://deno.land/std/examples/welcome.ts
Warning Implicitly using master branch https://deno.land/std/examples/welcome.ts
Compile file:///Users/khashayar/Desktop/deno2.js
error: Uncaught AssertionError: Unexpected skip of the emit.
at Object.assert ($deno$/util.ts:33:11)
at compile ($deno$/compiler.ts:1170:7)
at tsCompilerOnMessage ($deno$/compiler.ts:1338:22)
at workerMessageRecvCallback ($deno$/runtime_worker.ts:72:33)
at file:///Users/khashayar/Desktop/__anonymous__:1:1
Windows using Deno 1.0.5
import "https://deno.land/std/examples/welcome.ts"
$ deno run --allow-net deno2.js
output:
Compile file:///F:/ALL%20XAMPP/new/3/XAMPP/htdocs/Deno%20PlayGround/denoFirstApp/deno2.js
error: Uncaught AssertionError: Unexpected skip of the emit.
at Object.assert ($deno$/util.ts:33:11)
at compile ($deno$/compiler.ts:1170:7)
at tsCompilerOnMessage ($deno$/compiler.ts:1338:22)
at workerMessageRecvCallback ($deno$/runtime_worker.ts:72:33)
at file:///F:/ALL%20XAMPP/new/3/XAMPP/htdocs/Deno%20PlayGround/denoFirstApp/__anonymous__:1:1
It's happening to me when I import ts file into file with js extension.
Drakefile.js
import { desc, run, task, sh } from "https://deno.land/x/[email protected]/mod.ts"
desc("Minimal Drake task")
task("hello", [], async function(){
console.log("Hello from Drake!")
await sh('deno run --allow-env index.ts')
})
run()
deno run -A Drakefile.js hello
Renaming to .ts helped me
Getting the same on mac:
Compile file:///Users/edgaras/Documents/Sites/deno-sandbox/app.js error: Uncaught AssertionError: Unexpected skip of the emit. at Object.assert ($deno$/util.ts:33:11) at compile ($deno$/compiler.ts:1170:7) at tsCompilerOnMessage ($deno$/compiler.ts:1338:22) at workerMessageRecvCallback ($deno$/runtime_worker.ts:72:33) at file:///Users/edgaras/Documents/Sites/deno-sandbox/__anonymous__:1:1
1.1 update fixed it for me! Thanks, Bartek!
deno-lambda too! 馃憤
Got the emit error too but upgrading to Deno 1.1.1 fixed it.
Compile file:///Users/frankukachukwu/oss/dso/deps.ts
error: Uncaught AssertionError: Unexpected skip of the emit.
at Object.assert ($deno$/util.ts:33:11)
at compile ($deno$/compiler.ts:1345:7)
at async tsCompilerOnMessage ($deno$/compiler.ts:1548:22)
at async workerMessageRecvCallback ($deno$/runtime_worker.ts:74:9)
Most helpful comment
Update: I'm looking into this issue and found root cause. Fix will be released in Deno 1.1 in a few days.