itk-wasm icon indicating copy to clipboard operation
itk-wasm copied to clipboard

Error after importing itk-wasm

Open 1413194910 opened this issue 11 months ago • 9 comments

When I import itk-wasm my vue project reports an error! import { readImageDICOMArrayBufferSeries } from 'itk-wasm' The error is reported as follows ERROR Failed to compile with 4 errors 16:34:04

error in ./node_modules/itk-wasm/dist/core/internal/createWebWorkerPromise.js

Module parse failed: E:\Desktop\structure_report_byHMRRC_VUE\node_modules\itk-wasm\dist\core\internal\createWebWorkerPromise.js Unexpected token (34:82) You may need an appropriate loader to handle this file type. | // adds worker dynamic import support: | // https://bugzilla.mozilla.org/show_bug.cgi?id=1540913 | worker = new Worker(new URL('../../web-workers/pipeline.worker.js', import.meta.url)); | } | else {

@ ./node_modules/itk-wasm/dist/io/readImageArrayBuffer.js 1:0-80 @ ./node_modules/itk-wasm/dist/io/browser/index.js @ ./node_modules/itk-wasm/dist/index.js @ ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib/selector.js?type=script&index=0&bustCache!./src/views/modules/generator/biao.vue @ ./src/views/modules/generator/biao.vue @ ./src/views ^./.*.vue$ @ ./src/router/import-development.js @ ./src/router/index.js @ ./src/main.js @ multi (webpack)-dev-server/client?http://127.0.0.1:8001 webpack/hot/dev-server babel-polyfill ./src/main.js

error in ./node_modules/itk-wasm/dist/core/internal/loadEmscriptenModuleNode.js

Module parse failed: E:\Desktop\structure_report_byHMRRC_VUE\node_modules\itk-wasm\dist\core\internal\loadEmscriptenModuleNode.js Unexpected token (6:37) You may need an appropriate loader to handle this file type. | import { dirname } from 'path'; | import { createRequire } from 'module'; | globalThis.__dirname = dirname(import.meta.url); | globalThis.require = createRequire(import.meta.url); | async function loadEmscriptenModuleNode(modulePath) {

@ ./node_modules/itk-wasm/dist/pipeline/runPipelineNode.js 1:0-80 @ ./node_modules/itk-wasm/dist/pipeline/node/index.js @ ./node_modules/itk-wasm/dist/index.js @ ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib/selector.js?type=script&index=0&bustCache!./src/views/modules/generator/biao.vue @ ./src/views/modules/generator/biao.vue @ ./src/views ^./.*.vue$ @ ./src/router/import-development.js @ ./src/router/index.js @ ./src/main.js @ multi (webpack)-dev-server/client?http://127.0.0.1:8001 webpack/hot/dev-server babel-polyfill ./src/main.js

error in ./node_modules/itk-wasm/dist/io/internal/findLocalImageIOPath.js

Module parse failed: E:\Desktop\structure_report_byHMRRC_VUE\node_modules\itk-wasm\dist\io\internal\findLocalImageIOPath.js Unexpected token (4:54) You may need an appropriate loader to handle this file type. | import localPathRelativeToModule from './localPathRelativeToModule.js'; @ ./node_modules/itk-wasm/dist/io/polyDataToMeshNode.js 2:0-68 @ ./node_modules/itk-wasm/dist/io/node/index.js @ ./node_modules/itk-wasm/dist/index.js @ ./node_modules/babel-loader/lib!./node_modules/vue-loader/lib/selector.js?type=script&index=0&bustCache!./src/views/modules/generator/biao.vue @ ./src/views/modules/generator/biao.vue @ ./src/views ^./.*.vue$ @ ./src/router/import-development.js @ ./src/router/index.js @ ./src/main.js @ multi (webpack)-dev-server/client?http://127.0.0.1:8001 webpack/hot/dev-server babel-polyfill ./src/main.js

1413194910 avatar Jul 26 '23 08:07 1413194910

Hi,

is this with the latest version, 1.0.0-b119?

https://www.npmjs.com/package/itk-wasm?activeTab=versions

thewtex avatar Jul 26 '23 22:07 thewtex

"itk-wasm": "^1.0.0-a.0", 

Is it a version problem? I'll try the new version

1413194910 avatar Jul 27 '23 01:07 1413194910

你好,

这是最新版本 1.0.0-b119 吗?

https://www.npmjs.com/package/itk-wasm?activeTab=versions

I imported 1.0.0-b.119 but it still reports an error

1690421623353

1413194910 avatar Jul 27 '23 01:07 1413194910

Thanks for your reply,  I tried changing the version of ikt-wasm to 1.0.0-b119, but it still reported the error. Is it because this project is using node 8.11.1? But this project won't run without using node8.11.1. Is there any js that can be used instead of ikt-wasm? I've recently been trying to parse dicom files with dicom-parser.js however, vtk shows the dicom files. I look forward to hearing from you. - Thank you. ------------------ 原始邮件 ------------------ 发件人: "InsightSoftwareConsortium/itk-wasm" @.>; 发送时间: 2023年7月27日(星期四) 上午6:30 @.>; @.@.>; 主题: Re: [InsightSoftwareConsortium/itk-wasm] Error after importing itk-wasm (Issue #872)

Hi,

is this with the latest version, 1.0.0-b119?

https://www.npmjs.com/package/itk-wasm?activeTab=versions

— Reply to this email directly, view it on GitHub, or unsubscribe. You are receiving this because you authored the thread.Message ID: @.***>

1413194910 avatar Jul 27 '23 02:07 1413194910

Hi, yes, node 8 may not know what to do with import.meta.url. Node 8 was marked End of Life by the node team at the end of 2019. You could also try older versions itk-js, which was the previous name of this package.

thewtex avatar Jul 27 '23 18:07 thewtex

嗨,是的,节点 8 可能不知道如何处理import.meta.url。Node 8 已于 2019 年底被 Node 团队标记为“生命周期结束”。您也可以尝试旧版本itk-js,这是该软件包以前的名称。

Hi, older versions of itk.js don't seem to have the js that will parse the dicom file, I'd actually like to use readImageDICOMArrayBufferSeries from itk-wasm, but itk.js doesn't seem to have it.

1413194910 avatar Jul 28 '23 01:07 1413194910

It is possible to create a File from an ArrayBuffer.

thewtex avatar Jul 28 '23 01:07 thewtex

可以从 ArrayBuffer 创建文件

I'm sorry, I didn't understand what you meant, I'm in a situation where I can get the ArrayBuffe of the dicom file, and if I want to parse the supply to vtk.js for use then I have to use that method in itk.js?

1413194910 avatar Jul 28 '23 01:07 1413194910

A File can be created with new File([arrayBuffer], "file.dcm"). These can be passed to readImageDICOMFileSeries in itk.js, which can be converted to a vtkImageData for vtk.js.

thewtex avatar Jul 28 '23 11:07 thewtex