some node modules not working

Explorer ,
Dec 19, 2021 Dec 19, 2021

Copy link to clipboard

Copied

I'm trying to use node moduels like 'open ' and  'svgo' but i get this error "Unexpacted token import " the moment i require these modules, knowing that I'm already using some other modules like 

fs,childprocess,body-parser and they just working fine here is my json package 

 

{
    "name": "com.test.server",
    "version": "1.0.0",
    "description": "",
    "main": "index.js",
    "dependencies": {
        "body-parser": "^1.18.2",
        "express": "^4.16.3",
        "fs": "^0.0.1-security",
        "open": "^8.4.0",
        "request": "^2.85.0",
        "svgo": "^2.8.0"
    },
    "scripts": {
        "test": "echo \"Error: no test specified\" && exit 1"
    },
    "author": "",
    "license": "ISC"
}
​

 

TOPICS
Scripting , SDK

Views

103

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Dec 19, 2021 Dec 19, 2021

Copy link to clipboard

Copied

Unexpected token import? Hmm does the svgo have the same kind of file being imported as the ones that are working?
I wonder if there's an issue with the ones that are not svgo using commonJS and svgo maybe using esm or something.

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Dec 19, 2021 Dec 19, 2021

Copy link to clipboard

Copied

thanks silly-v  , i tried to use the svgo module just alone but I get the same error the moment I require the module

 

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Adobe Community Professional ,
Dec 20, 2021 Dec 20, 2021

Copy link to clipboard

Copied

LATEST

Yes, are you able to dig into the node_modules and examine the exact files which are being imported to detect a difference which may shed some light on just this import keyword issue. In the case that your normally working items are all a certain way that svgo is not, it may be possible then to somehow make edits and rectify such a difference.

 

Likes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines