Appsweet-co / npm-carbon

Copy npm packages and all their versions from one registry to another
MIT License
3 stars 2 forks source link

[FIX] Error: Cannot find module 'edit-json-file' #7

Closed HenriqueSilverio closed 2 years ago

HenriqueSilverio commented 2 years ago

Describe the bug Can't use any of lib commands.

To Reproduce Steps to reproduce the behavior:

  1. Run --help (or any other npm-carbon command).
npx @appsweet-co/npm-carbon --help

Expected behavior Prints a full list of commands.

Current behavior Throws MODULE_NOT_FOUND error.

node:internal/modules/cjs/loader:936
  throw err;
  ^

Error: Cannot find module 'edit-json-file'
Require stack:
- /Users/henrique/.npm/_npx/79a9db710315dff0/node_modules/@appsweet-co/npm-carbon/bin/cli.js
- /Users/henrique/.npm/_npx/79a9db710315dff0/node_modules/@appsweet-co/npm-carbon/bin/index.js
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
    at Function.Module._load (node:internal/modules/cjs/loader:778:27)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at Object.<anonymous> (/Users/henrique/.npm/_npx/79a9db710315dff0/node_modules/@appsweet-co/npm-carbon/bin/cli.js:17:40)
    at Module._compile (node:internal/modules/cjs/loader:1105:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1159:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Module.require (node:internal/modules/cjs/loader:1005:19) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/Users/henrique/.npm/_npx/79a9db710315dff0/node_modules/@appsweet-co/npm-carbon/bin/cli.js',
    '/Users/henrique/.npm/_npx/79a9db710315dff0/node_modules/@appsweet-co/npm-carbon/bin/index.js'
  ]
}

Desktop:

dperuo commented 2 years ago

Got it!

dperuo commented 2 years ago

@HenriqueSilverio - We'll let you know when the fix goes live

dperuo commented 2 years ago

May or may not be related to breaking changes in Node v16.

HenriqueSilverio commented 2 years ago

@dperuo What's the Node (and npm) version that you tested the lib against and was worked?

I tried to run with "node v14.19.2 (npm v6.14.17)" and "node v12.22.12 (npm v6.14.16)", and the same errors occurred.

Edit 1: I was wondering, if this isn't something related to some third party lib used here, that was updated and broke things, instead of Node changes.

node v16.15.0 (npm v8.5.5)

npx @appsweet-co/npm-carbon --help
node:internal/modules/cjs/loader:936
  throw err;
  ^

Error: Cannot find module 'edit-json-file'
Require stack:
- /Users/henrique/.npm/_npx/79a9db710315dff0/node_modules/@appsweet-co/npm-carbon/bin/cli.js
- /Users/henrique/.npm/_npx/79a9db710315dff0/node_modules/@appsweet-co/npm-carbon/bin/index.js
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
    at Function.Module._load (node:internal/modules/cjs/loader:778:27)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at Object.<anonymous> (/Users/henrique/.npm/_npx/79a9db710315dff0/node_modules/@appsweet-co/npm-carbon/bin/cli.js:17:40)
    at Module._compile (node:internal/modules/cjs/loader:1105:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1159:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Module.require (node:internal/modules/cjs/loader:1005:19) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/Users/henrique/.npm/_npx/79a9db710315dff0/node_modules/@appsweet-co/npm-carbon/bin/cli.js',
    '/Users/henrique/.npm/_npx/79a9db710315dff0/node_modules/@appsweet-co/npm-carbon/bin/index.js'
  ]
}

node v14.19.2 (npm v6.14.17)

npx @appsweet-co/npm-carbon --help
Cannot find module 'edit-json-file'
Require stack:
- /Users/henrique/.npm/_npx/82534/lib/node_modules/@appsweet-co/npm-carbon/bin/cli.js
- /Users/henrique/.npm/_npx/82534/lib/node_modules/@appsweet-co/npm-carbon/bin/index.js

node v12.22.12 (npm v6.14.16)

npx @appsweet-co/npm-carbon --help
Cannot find module 'edit-json-file'
Require stack:
- /Users/henrique/.npm/_npx/82992/lib/node_modules/@appsweet-co/npm-carbon/bin/cli.js
- /Users/henrique/.npm/_npx/82992/lib/node_modules/@appsweet-co/npm-carbon/bin/index.js
dperuo commented 2 years ago

@HenriqueSilverio - You might be correct. There's something about this edit-json-file dependency.

We don't use the edit-json-file dependency directly. Looks like TypeScript adds it during compile time.

dperuo commented 2 years ago

I think fibrous caused the original issue.

Will try refactoring the code to avoid fibrous.

dperuo commented 2 years ago

@HenriqueSilverio - I think we fixed the issue. Please install v1.0.12 and let me know how it goes.

Please open a new ticket if you still have issues.