Problems with the import syntax Node js - node.js

I'm trying to probe a npm packet with node. The packet is this but when I'm doing the node script.js the following error appear on the console. This is what I'm trying to do:
import { get } from 'http'
import { http } from 'get-headers'
get('http://example.com', (res) => {
http(res) //=> { 'Accept-Ranges': 'bytes', 'Cache-Control': 'max-age=604800', 'Content-Type': 'text/html', Date: 'Mon, 17 Aug 2015 19:53:03 GMT', Etag: '"359670651"', Expires: 'Mon, 24 Aug 2015 19:53:03 GMT', 'Last-Modified': 'Fri, 09 Aug 2013 23:54:35 GMT', Server: 'ECS (rhv/818F)', 'X-Cache': 'HIT', 'x-ec-custom-error': '1', 'Content-Length': '1270', Connection: 'close' }
})
The error is the following:
(function (exports, require, module, __filename, __dirname) { import { get } from 'http';
^
SyntaxError: Unexpected token {
at new Script (vm.js:85:7)
at createScript (vm.js:266:10)
at Object.runInThisContext (vm.js:314:10)
at Module._compile (internal/modules/cjs/loader.js:698:28)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:749:10)
at Module.load (internal/modules/cjs/loader.js:630:32)
at tryModuleLoad (internal/modules/cjs/loader.js:570:12)
at Function.Module._load (internal/modules/cjs/loader.js:562:3)
at Function.Module.runMain (internal/modules/cjs/loader.js:801:12)
at internal/main/run_main_module.js:21:11
I've installed the two packages in the node_modules dir, I think that the mistake is because the interpreter doesn't understand the recent ecmascript and I've to do it whit the require but I've installed the latest version of node. Any idea of what could be happening?. Thank you
node --version 10:43
v11.10.1
UPDATE: I also tried to do it with the experimental flag but it yields this error.
ERROR
(node:12479) ExperimentalWarning: The ESM module loader is experimental.
/home/...:1
(function (exports, require, module, __filename, __dirname) { import { get } from 'http';
^
SyntaxError: Unexpected token {
at new Script (vm.js:85:7)
at createScript (vm.js:266:10)
at Proxy.runInThisContext (vm.js:314:10)
at Module._compile (internal/modules/cjs/loader.js:698:28)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:749:10)
at Module.load (internal/modules/cjs/loader.js:630:32)
at tryModuleLoad (internal/modules/cjs/loader.js:570:12)
at Function.Module._load (internal/modules/cjs/loader.js:562:3)
at createDynamicModule (internal/modules/esm/translators.js:78:15)
at Object.meta.done (internal/modules/esm/create_dynamic_module.js:40:9)

You are missing running the node app with the --experimental-modules flag enabled. Otherwise import is unknown for node you can see here a similar answer https://stackoverflow.com/a/54384132/4229159
Read here about import compatibility

Related

auth operation not supported in this environment

I am trying to build a google authentication in signup/login using firebase in my express with handlebar application but on clicking button & doing the pre-requisites as per firebase-auth docs it is giving me the error as follows:
auth/operation-not-supported-in-this-environment
to be precise as follows :
FirebaseError: Firebase: Error (auth/operation-not-supported-in-this-environment).
at createErrorInternal (D:\web developement\myna\sample project\node_modules#firebase\auth\dist\node\index-69e083b1.js:509:47)
at _createError (D:\web developement\myna\sample project\node_modules#firebase\auth\dist\node\index-69e083b1.js:485:32)
at Object. (D:\web developement\myna\sample project\node_modules#firebase\auth\dist\node\index-69e083b1.js:7273:27)
at Module._compile (node:internal/modules/cjs/loader:1159:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1213:10)
at Module.load (node:internal/modules/cjs/loader:1037:32)
at Module._load (node:internal/modules/cjs/loader:878:12)
at Module.require (node:internal/modules/cjs/loader:1061:19)
at require (node:internal/modules/cjs/helpers:103:18)
at Object. (D:\web developement\myna\sample project\node_modules#firebase\auth\dist\node\index.js:5:13) {
code: 'auth/operation-not-supported-in-this-environment',
customData: {}
}
i am not getting a clue, what is causing it & in order to solve it what should i do

node- Some file references are missing in stack trace with async/await

Stacktrace is not having the reference to actual file name from where the error is triggered for the protractor.
Spec reporter configuration:
jasmine.getEnv().addReporter(new SpecReporter({spec: {displayStacktrace: true,}}));
Sample spec:
it('Protractor stacktrce issue', async () =>
{
const helper = new SearchHelper();
await helper.doSearch('test');
});
search-helper.ts:
async doSearch(text) {
await browser.get('http://google.com');
await browser.wait(EC.visibilityOf(element(by.name('q1'))), 10000, 'No Element found');
await element(by.name('q1')).click(); //invalid locator
}
1. Stack Trace with browser.wait
✗ Protractor stack trace issue
-Failed: No Element found Wait timed out after 10007ms
Wait timed out after 10007ms
at WebDriverError (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/error.js:27:5)
at TimeoutError (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/error.js:238:5)
at /usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/promise.js:2107:17
at process._tickCallback (internal/process/next_tick.js:109:7)
From asynchronous test: Error at Suite.<anonymous> (/Users/e2e/sample-spec.ts:27:3)
at Object.<anonymous> (/Users/e2e/sample-spec.ts:15:1)
at Module._compile (module.js:570:32) at Module.m._compile (/Users/node_modules/ts-node/src/index.ts:392:23)
at Module._extensions..js (module.js:579:10)
at Object.require.extensions.(anonymous function) [as .ts] (/Users/node_modules/ts-node/src/index.ts:395:12)
2. If we comment browser.wait statement then the stacktrace is
✗ Protractor stack trace issue
Failed: No element found using locator: By(css selector, *[name="q1"])
at WebDriverError (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/error.js:27:5)
at NoSuchElementError (/usr/local/lib/node_modules/protractor/node_modules/selenium-webdriver/lib/error.js:168:5)
at elementArrayFinder.getWebElements.then (/usr/local/lib/node_modules/protractor/lib/element.ts:851:17)
at process._tickCallback (internal/process/next_tick.js:109:7)Error
at ElementArrayFinder.applyAction_ (/usr/local/lib/node_modules/protractor/lib/element.ts:482:23)
at ElementArrayFinder.(anonymous function) [as click] (/usr/local/lib/node_modules/protractor/lib/element.ts:96:21)
at ElementFinder.(anonymous function) [as click] (/usr/local/lib/node_modules/protractor/lib/element.ts:873:14)
at SearchHelper.<anonymous> (/Users/e2e/search-helper.ts:14:34) **at step (/Users/e2e/search-helper.ts:32:23)
at Object.next (/Users/e2e/search-heper.ts:13:53)
at fulfilled (/Users/e2e/search-helper.ts:4:58)**
at process._tickCallback (internal/process/next_tick.js:109:7)
From asynchronous test: Error at Suite.<anonymous> (/Users/e2e/sample-spec.ts:27:3)
at Object.<anonymous> (/Users/e2e/sample-spec.ts:15:1) at Module._compile (module.js:570:32)
at Module.m._compile (/Users/node_modules/ts-node/src/index.ts:392:23)
at Module._extensions..js (module.js:579:10)
at Object.require.extensions.(anonymous function) [as .ts] (/Users/node_modules/ts-node/src/index.ts:395:12)
Observe the 2nd stack trace, it has references to search-helper file but it's not there in the first stack trace. It's very important to have this reference in stack trace for debugging.

Decrypting openssl aes-256-cbc using node.js?

I'm encrypting my file on the command line using:
openssl aes-256-cbc -e -in test.env -out test.env.encrypted
and then trying to decrypt on node.js with:
crypto = require('crypto')
algorithm = 'aes-256-cbc'
password = 'test'
fs = require 'fs'
decrypt = (text) ->
decipher = crypto.createDecipher(algorithm, password)
dec = decipher.update(text, 'hex', 'utf8')
dec += decipher.final('utf8')
dec
file = fs.readFileSync './test.env.encrypted', 'utf-8'
console.log decrypt file
But i'm getting the following error:
TypeError: Bad input string at Decipher.update (crypto.js:168:26) at decrypt (/Users/h/tmp/encrypt_test/test.coffee:10:18) at Object.<anonymous> (/Users/h/tmp/encrypt_test/test.coffee:16:13) at Object.<anonymous> (/Users/h/tmp/encrypt_test/test.coffee:1:1) at Module._compile (module.js:569:30) at Object.CoffeeScript.run (/usr/local/lib/node_modules/coffeescript/lib/coffeescript/index.js:63:23) at compileScript (/usr/local/lib/node_modules/coffeescript/lib/coffeescript/command.js:265:29) at compilePath (/usr/local/lib/node_modules/coffeescript/lib/coffeescript/command.js:220:14) at Object.exports.run (/usr/local/lib/node_modules/coffeescript/lib/coffeescript/command.js:141:20) at Object.<anonymous> (/usr/local/lib/node_modules/coffeescript/bin/coffee:15:45) at Module._compile (module.js:569:30) at Object.Module._extensions..js (module.js:580:10) at Module.load (module.js:503:32) at tryModuleLoad (module.js:466:12) at Function.Module._load (module.js:458:3) at Function.Module.runMain (module.js:605:10) at startup (bootstrap_node.js:158:16) at bootstrap_node.js:575:3
What am i doing wrong?
UPDATE:
As per James note i'm now sending a "hex" string to my decrypt function:
crypto = require('crypto')
algorithm = 'aes-256-cbc'
password = 'test'
fs = require 'fs'
decrypt = (text) ->
decipher = crypto.createDecipher(algorithm, password)
dec = decipher.update(text, 'hex', 'utf8')
dec += decipher.final('utf8')
dec
file = fs.readFileSync './test.env.encrypted'
console.log decrypt file.toString('hex')
But then it's yielding a new error:
Error: error:06065064:digital envelope routines:EVP_DecryptFinal_ex:bad decrypt
at Decipher.final (crypto.js:181:26)
at decrypt (/Users/h/tmp/encrypt_test/test.coffee:12:19)
at Object.<anonymous> (/Users/h/tmp/encrypt_test/test.coffee:17:13)
at Object.<anonymous> (/Users/h/tmp/encrypt_test/test.coffee:1:1)
at Module._compile (module.js:569:30)
at Object.CoffeeScript.run (/usr/local/lib/node_modules/coffeescript/lib/coffeescript/index.js:63:23)
at compileScript (/usr/local/lib/node_modules/coffeescript/lib/coffeescript/command.js:265:29)
at compilePath (/usr/local/lib/node_modules/coffeescript/lib/coffeescript/command.js:220:14)
at Object.exports.run (/usr/local/lib/node_modules/coffeescript/lib/coffeescript/command.js:141:20)
at Object.<anonymous> (/usr/local/lib/node_modules/coffeescript/bin/coffee:15:45)
at Module._compile (module.js:569:30)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:503:32)
at tryModuleLoad (module.js:466:12)
at Function.Module._load (module.js:458:3)
at Function.Module.runMain (module.js:605:10)
at startup (bootstrap_node.js:158:16)
at bootstrap_node.js:575:3
File was encrypted using:
openssl aes-256-cbc -e -in test.env -out test.env.encrypted
with
test
as password
Your call to decipher.update expects a hex encoded string but you're passing a utf-8 string.
Either change your readFileSync to read with hex encoding or change the update call to expect utf-8 input.

selenium WebDriverError: connection refused nodejs

node version: v8.5.0
npm version: 5.3.0
geckodriver: v0.19.0
"selenium-webdriver": "^3.5.0"
I'm trying to test selenium webdriver in nodejs, however I keep getting the following error:
/home/app_path/node_modules/selenium-webdriver/lib/promise.js:2634
throw error;
^
WebDriverError: connection refused
at Object.throwDecodedError (/home/app_path/node_modules/selenium-webdriver/lib/error.js:497:15)
at parseHttpResponse (/home/app_path/node_modules/selenium-webdriver/lib/http.js:519:13)
at doSend.then.response (/home/app_path/node_modules/selenium-webdriver/lib/http.js:441:30)
at <anonymous>
at process._tickDomainCallback (internal/process/next_tick.js:228:7)
From: Task: WebDriver.createSession()
at Function.createSession (/home/app_path/node_modules/selenium-webdriver/lib/webdriver.js:769:24)
at Function.createSession (/home/app_path/node_modules/selenium-webdriver/firefox/index.js:572:41)
at createDriver (/home/app_path/node_modules/selenium-webdriver/index.js:170:33)
at Builder.build (/home/app_path/node_modules/selenium-webdriver/index.js:645:16)
at Object.<anonymous> (/home/app_path/app.js:20:2)
at Module._compile (module.js:624:30)
at Object.Module._extensions..js (module.js:635:10)
at Module.load (module.js:545:32)
at tryModuleLoad (module.js:508:12)
at Function.Module._load (module.js:500:3)
at Function.Module.runMain (module.js:665:10)
at startup (bootstrap_node.js:201:16)
at bootstrap_node.js:626:3
A Mozilla firefox window just opens, and after some time, this error appears in console. This is what I'm trying to do:
var webdriver = require('selenium-webdriver'),
By = webdriver.By,
until = webdriver.until;
var driver = new webdriver.Builder()
.forBrowser('firefox')
.build().then(function(){
console.log("log");
driver.get("https://google.co.in");
});
how to fix this?
EDIT Here's the stacktrace
{"value":{"error":"unknown error","message":"connection refused","stacktrace":"stack backtrace:\n 0: 0x4f388c - backtrace::backtrace::trace::h736111741fa0878e\n 1: 0x4f38c2 - backtrace::capture::Backtrace::new::h63b8a5c0787510c9\n 2: 0x442d88 - webdriver::error::WebDriverError::new::hea6d4dbf778b2b24\n 3: 0x449f99 - geckodriver::marionette::MarionetteHandler::create_connection::hf8b6061dba65cdd0\n 4: 0x42ac91 - >::run::hba9181b5aacf8f04\n 5: 0x402c59 - std::sys_common::backtrace::__rust_begin_short_backtrace::h19de262639927233\n 6: 0x40c065 - std::panicking::try::do_call::h6c1659fc4d01af51\n 7: 0x5e38ec - panic_unwind::__rust_maybe_catch_panic\n at /checkout/src/libpanic_unwind/lib.rs:98\n 8: 0x420d32 - >::call_box::h953e5f59694972c5\n 9: 0x5dc00b - alloc::boxed::{{impl}}::call_once<(),()>\n at /checkout/src/liballoc/boxed.rs:661\n - std::sys_common::thread::start_thread\n at /checkout/src/libstd/sys_common/thread.rs:21\n - std::sys::imp::thread::{{impl}}::new::thread_start\n at /checkout/src/libstd/sys/unix/thread.rs:84"}}

How to override eslint-plugin-import resolver while using airbnb

I'm trying to use eslint-import-resolver-babel-module but without success. Airbnb config uses "node" resolver, and it seems that only it is used.
Here's my config:
{
"env": {
"browser": true
},
"extends": "airbnb",
"plugins": [
"react",
"jsx-a11y",
"import"
],
"rules": {
"no-param-reassign": [2, { "props": false }]
},
"parser": "babel-eslint",
"root": true,
"settings": {
"import/resolver": {
"babel-module": {}
}
}
}
I get compiled config using this:
$ ./node_modules/.bin/eslint --print-config src/test.js > eslintconfig 2>&1
Excerpt from the result:
...
"settings": {
"import/resolver": {
"node": {
"extensions": [
".js",
".jsx",
".json"
]
},
"babel-module": {}
},
...
Then I test using this command
$ cross-env DEBUG=eslint-plugin-import:resolver:* ./node_modules/.bin/eslint src/test.js > eslintdebug 2>&1
Output
Sun, 06 Aug 2017 14:16:33 GMT eslint-plugin-import:resolver:node Resolving: client/test2 from: D:XXX\src\test.js
Sun, 06 Aug 2017 14:16:33 GMT eslint-plugin-import:resolver:node resolve threw error: { Error: Cannot find module 'client/test2' from 'D:XXX\src'
at Function.module.exports [as sync] (D:XXX\node_modules\resolve\lib\sync.js:40:15)
at Object.exports.resolve (D:XXX\node_modules\eslint-import-resolver-node\index.js:18:28)
at v2 (D:XXX\node_modules\eslint-module-utils\resolve.js:79:23)
at withResolver (D:XXX\node_modules\eslint-module-utils\resolve.js:84:16)
at fullResolve (D:XXX\node_modules\eslint-module-utils\resolve.js:101:22)
at relative (D:XXX\node_modules\eslint-module-utils\resolve.js:46:10)
at resolve (D:XXX\node_modules\eslint-module-utils\resolve.js:172:12)
at checkSourceValue (D:XXX\node_modules\eslint-plugin-import\lib\rules\no-unresolved.js:29:50)
at checkSourceValue (D:XXX\node_modules\eslint-module-utils\moduleVisitor.js:29:5)
at EventEmitter.checkSource (D:XXX\node_modules\eslint-module-utils\moduleVisitor.js:34:5) code: 'MODULE_NOT_FOUND' }
Sun, 06 Aug 2017 14:16:33 GMT eslint-plugin-import:resolver:node Resolving: client/test2 from: D:XXX\src\test.js
Sun, 06 Aug 2017 14:16:33 GMT eslint-plugin-import:resolver:node resolve threw error: { Error: Cannot find module 'client/test2' from 'D:XXX\src'
at Function.module.exports [as sync] (D:XXX\node_modules\resolve\lib\sync.js:40:15)
at Object.exports.resolve (D:XXX\node_modules\eslint-import-resolver-node\index.js:18:28)
at v2 (D:XXX\node_modules\eslint-module-utils\resolve.js:79:23)
at withResolver (D:XXX\node_modules\eslint-module-utils\resolve.js:84:16)
at fullResolve (D:XXX\node_modules\eslint-module-utils\resolve.js:101:22)
at relative (D:XXX\node_modules\eslint-module-utils\resolve.js:46:10)
at resolve (D:XXX\node_modules\eslint-module-utils\resolve.js:172:12)
at resolveImportType (D:XXX\node_modules\eslint-plugin-import\lib\core\importType.js:74:65)
at reportIfMissing (D:XXX\node_modules\eslint-plugin-import\lib\rules\no-extraneous-dependencies.js:74:32)
at EventEmitter.ImportDeclaration (D:XXX\node_modules\eslint-plugin-import\lib\rules\no-extraneous-dependencies.js:144:9) code: 'MODULE_NOT_FOUND' }
Sun, 06 Aug 2017 14:16:33 GMT eslint-plugin-import:resolver:node Resolving: client/test2 from: D:XXX\src\test.js
Sun, 06 Aug 2017 14:16:33 GMT eslint-plugin-import:resolver:node resolve threw error: { Error: Cannot find module 'client/test2' from 'D:XXX\src'
at Function.module.exports [as sync] (D:XXX\node_modules\resolve\lib\sync.js:40:15)
at Object.exports.resolve (D:XXX\node_modules\eslint-import-resolver-node\index.js:18:28)
at v2 (D:XXX\node_modules\eslint-module-utils\resolve.js:79:23)
at withResolver (D:XXX\node_modules\eslint-module-utils\resolve.js:84:16)
at fullResolve (D:XXX\node_modules\eslint-module-utils\resolve.js:101:22)
at relative (D:XXX\node_modules\eslint-module-utils\resolve.js:46:10)
at resolve (D:XXX\node_modules\eslint-module-utils\resolve.js:172:12)
at EventEmitter.ImportDeclaration (D:XXX\node_modules\eslint-plugin-import\lib\rules\no-duplicates.js:37:52)
at emitOne (events.js:101:20)
at EventEmitter.emit (events.js:191:7) code: 'MODULE_NOT_FOUND' }
Sun, 06 Aug 2017 14:16:33 GMT eslint-plugin-import:resolver:node Resolving: client/test2 from: D:XXX\src\test.js
Sun, 06 Aug 2017 14:16:33 GMT eslint-plugin-import:resolver:node resolve threw error: { Error: Cannot find module 'client/test2' from 'D:XXX\src'
at Function.module.exports [as sync] (D:XXX\node_modules\resolve\lib\sync.js:40:15)
at Object.exports.resolve (D:XXX\node_modules\eslint-import-resolver-node\index.js:18:28)
at v2 (D:XXX\node_modules\eslint-module-utils\resolve.js:79:23)
at withResolver (D:XXX\node_modules\eslint-module-utils\resolve.js:84:16)
at fullResolve (D:XXX\node_modules\eslint-module-utils\resolve.js:101:22)
at relative (D:XXX\node_modules\eslint-module-utils\resolve.js:46:10)
at resolve (D:XXX\node_modules\eslint-module-utils\resolve.js:172:12)
at EventEmitter.checkFileExtension (D:XXX\node_modules\eslint-plugin-import\lib\rules\extensions.js:81:50)
at emitOne (events.js:101:20)
at EventEmitter.emit (events.js:191:7) code: 'MODULE_NOT_FOUND' }
Sun, 06 Aug 2017 14:16:33 GMT eslint-plugin-import:resolver:node Resolving: client/test2 from: D:XXX\src\test.js
Sun, 06 Aug 2017 14:16:33 GMT eslint-plugin-import:resolver:node resolve threw error: { Error: Cannot find module 'client/test2' from 'D:XXX\src'
at Function.module.exports [as sync] (D:XXX\node_modules\resolve\lib\sync.js:40:15)
at Object.exports.resolve (D:XXX\node_modules\eslint-import-resolver-node\index.js:18:28)
at v2 (D:XXX\node_modules\eslint-module-utils\resolve.js:79:23)
at withResolver (D:XXX\node_modules\eslint-module-utils\resolve.js:84:16)
at fullResolve (D:XXX\node_modules\eslint-module-utils\resolve.js:101:22)
at relative (D:XXX\node_modules\eslint-module-utils\resolve.js:46:10)
at resolve (D:XXX\node_modules\eslint-module-utils\resolve.js:172:12)
at Function.ExportMap.get (D:XXX\node_modules\eslint-plugin-import\lib\ExportMap.js:281:38)
at checkDefault (D:XXX\node_modules\eslint-plugin-import\lib\rules\no-named-as-default.js:25:41)
at emitOne (events.js:101:20) code: 'MODULE_NOT_FOUND' }
Sun, 06 Aug 2017 14:16:33 GMT eslint-plugin-import:resolver:node Resolving: client/test2 from: D:XXX\src\test.js
Sun, 06 Aug 2017 14:16:33 GMT eslint-plugin-import:resolver:node resolve threw error: { Error: Cannot find module 'client/test2' from 'D:XXX\src'
at Function.module.exports [as sync] (D:XXX\node_modules\resolve\lib\sync.js:40:15)
at Object.exports.resolve (D:XXX\node_modules\eslint-import-resolver-node\index.js:18:28)
at v2 (D:XXX\node_modules\eslint-module-utils\resolve.js:79:23)
at withResolver (D:XXX\node_modules\eslint-module-utils\resolve.js:84:16)
at fullResolve (D:XXX\node_modules\eslint-module-utils\resolve.js:101:22)
at relative (D:XXX\node_modules\eslint-module-utils\resolve.js:46:10)
at resolve (D:XXX\node_modules\eslint-module-utils\resolve.js:172:12)
at Function.ExportMap.get (D:XXX\node_modules\eslint-plugin-import\lib\ExportMap.js:281:38)
at EventEmitter.handleImportDefault (D:XXX\node_modules\eslint-plugin-import\lib\rules\no-named-as-default-member.js:35:45)
at emitOne (events.js:101:20) code: 'MODULE_NOT_FOUND' }
[4mD:XXX\src\test.js[24m
[2m1:1[22m [31merror[39m Resolve error: undefined [2mimport/no-unresolved[22m
[2m1:1[22m [31merror[39m Resolve error: undefined [2mimport/no-extraneous-dependencies[22m
[2m1:1[22m [31merror[39m 'client' should be listed in the project's dependencies. Run 'npm i -S client' to add it [2mimport/no-extraneous-dependencies[22m
[2m1:1[22m [31merror[39m Resolve error: undefined [2mimport/no-duplicates[22m
[2m1:1[22m [31merror[39m Resolve error: undefined [2mimport/extensions[22m
[2m1:1[22m [31merror[39m Resolve error: undefined [2mimport/no-named-as-default[22m
[2m1:1[22m [31merror[39m Resolve error: undefined [2mimport/no-named-as-default-member[22m
[2m1:8[22m [31merror[39m 'test' is defined but never used [2mno-unused-vars[22m
[2m1:18[22m [31merror[39m Unable to resolve path to module 'client/test2' [2mimport/no-unresolved[22m
[2m1:18[22m [31merror[39m Missing file extension for "client/test2" [2mimport/extensions[22m
[31m[1m✖ 10 problems (10 errors, 0 warnings)
[22m[39m
And here as you can see only eslint-plugin-import:resolver:node is used, no sight of eslint-plugin-import:resolver:babel-module.
I've also tried this:
"settings": {
"import/resolver": "babel-module"
}
But results are even worse:
[4mD:XXX\src\test.js[24m
[2m1:1[22m [31merror[39m Resolve error: undefined [2mimport/no-unresolved[22m
[2m1:1[22m [31merror[39m Resolve error: undefined [2mimport/no-extraneous-dependencies[22m
[2m1:1[22m [31merror[39m 'client' should be listed in the project's dependencies. Run 'npm i -S client' to add it [2mimport/no-extraneous-dependencies[22m
[2m1:1[22m [31merror[39m Resolve error: undefined [2mimport/no-duplicates[22m
[2m1:1[22m [31merror[39m Resolve error: undefined [2mimport/extensions[22m
[2m1:1[22m [31merror[39m Resolve error: undefined [2mimport/no-named-as-default[22m
[2m1:1[22m [31merror[39m Resolve error: undefined [2mimport/no-named-as-default-member[22m
[2m1:8[22m [31merror[39m 'test' is defined but never used [2mno-unused-vars[22m
[2m1:18[22m [31merror[39m Unable to resolve path to module 'client/test2' [2mimport/no-unresolved[22m
[2m1:18[22m [31merror[39m Missing file extension for "client/test2" [2mimport/extensions[22m
[31m[1m✖ 10 problems (10 errors, 0 warnings)
[22m[39m
Dependencies versions:
$ npm ls babel-plugin-module-resolver eslint-import-resolver-babel-module eslint-config-airbnb eslint-plugin-import eslint
house#0.1.0 D:\XXX
+-- babel-plugin-module-resolver#2.7.1
+-- eslint#3.19.0
+-- eslint-config-airbnb#15.0.2
+-- eslint-import-resolver-babel-module#3.0.0
`-- eslint-plugin-import#2.7.0
How to override plugin settings of parent config?
It turns out eslint-plugin-import takes a list of resolvers, and checks them one by one until one of them resolves the file correctly.

Resources