Cli: [BUG] `Error: bad marker at ConfigChain.add` using fnm with node v12.14.1

Created on 12 Aug 2020  ·  6Comments  ·  Source: npm/cli

Current Behavior:

When running npm or npx this error happens:

Error: bad marker
    at ConfigChain.add (/Users/j42/.fnm/node-versions/v12.14.1/installation/lib/node_modules/npm/node_modules/config-chain/index.js:252:33)
    at Conf.add (/Users/j42/.fnm/node-versions/v12.14.1/installation/lib/node_modules/npm/lib/config/core.js:264:27)
    at ConfigChain.addString (/Users/j42/.fnm/node-versions/v12.14.1/installation/lib/node_modules/npm/node_modules/config-chain/index.js:244:8)
    at Conf.<anonymous> (/Users/j42/.fnm/node-versions/v12.14.1/installation/lib/node_modules/npm/lib/config/core.js:242:10)
    at /Users/j42/.fnm/node-versions/v12.14.1/installation/lib/node_modules/npm/node_modules/graceful-fs/graceful-fs.js:123:16
    at FSReqCallback.readFileAfterClose [as oncomplete] (internal/fs/read_file_context.js:61:3)
/Users/j42/.fnm/node-versions/v12.14.1/installation/lib/node_modules/npm/lib/npm.js:18
    throw new Error('npm.load() required')
    ^

Error: npm.load() required
    at Object.get (/Users/j42/.fnm/node-versions/v12.14.1/installation/lib/node_modules/npm/lib/npm.js:18:11)
    at process.errorHandler (/Users/j42/.fnm/node-versions/v12.14.1/installation/lib/node_modules/npm/lib/utils/error-handler.js:177:32)
    at process.emit (events.js:223:5)
    at process._fatalException (internal/process/execution.js:150:25)

Expected Behavior:

npm should be usable

Steps To Reproduce:

  • npm i -g npm@next-7
  • npm & npx are now completely broken 🤷‍♂️

Environment:

  • OS: macOS 10.15.6 (Catalina)
  • Node: 12.14.1
  • NPM: 7.0.0-beta.4
  • fnm: 1.18.1
Bug Release 7.x beta

All 6 comments

Yeah, we encountered this in the CITGM tests just recently, I was wondering if anyone would run into that race condition outside of CITGM.

Currently in the middle of clearing out all the old code in lib/config/, should be fixed (or at least, broken more interestingly!) in the next beta.

In the meantime, the best approach is probably to have nvm reinstall node 12.14.1 so you get a fresh v6 version.

Ok I guess I that was bad luck for me 😄

I managed to reinstall npm from another open shell in the end so all good.

I'm facing the same issue on Windows. Uninstalling and re-installing NodeJS doesn't revert the npm to v6. What would be the way to revert npm on Windows?

@AakashM maybe deleting the folders manually and then reinstalling could help.

https://stackoverflow.com/a/20711410/1345244

@isaacs This is still happening on v7.0.0-beta5, breaking exactly like in beta4.

Error: bad marker
    at ConfigChain.add (C:\Users\tatuu\AppData\Roaming\npm\node_modules\npm\node_modules\config-chain\index.js:252:33)
    at Conf.add (C:\Users\tatuu\AppData\Roaming\npm\node_modules\npm\lib\config\core.js:264:27)
    at ConfigChain.addString (C:\Users\tatuu\AppData\Roaming\npm\node_modules\npm\node_modules\config-chain\index.js:244:8)
    at Conf.<anonymous> (C:\Users\tatuu\AppData\Roaming\npm\node_modules\npm\lib\config\core.js:242:10)
    at C:\Users\tatuu\AppData\Roaming\npm\node_modules\npm\node_modules\graceful-fs\graceful-fs.js:123:16
    at FSReqCallback.readFileAfterClose [as oncomplete] (internal/fs/read_file_context.js:63:3)
C:\Users\tatuu\AppData\Roaming\npm\node_modules\npm\lib\npm.js:18
    throw new Error('npm.load() required')
    ^

Error: npm.load() required
    at Object.get (C:\Users\tatuu\AppData\Roaming\npm\node_modules\npm\lib\npm.js:18:11)
    at process.errorHandler (C:\Users\tatuu\AppData\Roaming\npm\node_modules\npm\lib\utils\error-handler.js:177:32)
    at process.emit (events.js:315:20)
    at process._fatalException `(internal/process/execution.js:165:25)

Environment:

  • OS: Windows 10
  • Node: v13.12.0
  • NPM: v7.0.0-beta.5

Yes, I know. It's fixed by #1688, just landed today, which will be in beta.6.

You can npm i -g npm@github:npm/cli#release/v7.0.0-beta right now if you want to check it out.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

1000i100 picture 1000i100  ·  3Comments

ahuglajbclajep picture ahuglajbclajep  ·  3Comments

darcyclarke picture darcyclarke  ·  3Comments

goldingdamien picture goldingdamien  ·  4Comments

darcyclarke picture darcyclarke  ·  4Comments