Created a project with custom npx command
"bin": {"myCommand": "./bin/myJsFile.js"}
js file is in ES6 and use the import statement to import a file say importFile written in ES6.
I deploy the command locally using npm i -g
when I try to run it locally using npx
.
Error [ERR_MODULE_NOT_FOUND]: Cannot find module 'C:\project\src\importFile ' imported from C:\project\src\bin\myJsFile.js
at new NodeError (node:internal/errors:371:5)
at finalizeResolution (node:internal/modules/esm/resolve:416:11)
at moduleResolve (node:internal/modules/esm/resolve:932:10)
at defaultResolve (node:internal/modules/esm/resolve:1044:11)
at ESMLoader.resolve (node:internal/modules/esm/loader:422:30)