Cannot run any npm command after Node and npm upgrade

Discussão em 'Angular' iniciado por Giannis, Setembro 11, 2025.

  1. Giannis

    Giannis Guest

    After upgrading to the latest Node and npm version, when I try any npm command, I get the following error:

    C:\Users\...>npm doctor
    TypeError: Cannot read property 'prefix' of undefined
    at parseField (C:\Users\...\npm\node_modules\npm\node_modules\@npmcli\config\lib\parse-field.js:15:43)
    at Config.parseField (C:\Users\...\npm\node_modules\npm\node_modules\@npmcli\config\lib\index.js:438:12)
    at Config.[loadObject] (C:\Users\...\npm\node_modules\npm\node_modules\@npmcli\config\lib\index.js:430:24)
    at Config.loadDefaults (C:\Users\...\npm\node_modules\npm\node_modules\@npmcli\config\lib\index.js:268:22)
    at Config.load (C:\Users\...\npm\node_modules\npm\node_modules\@npmcli\config\lib\index.js:207:10)
    at Object.[_load] (C:\Users\...\npm\node_modules\npm\lib\npm.js:176:23)
    Error: call config.load() before reading values
    at Config.get (C:\Users\...\npm\node_modules\npm\node_modules\@npmcli\config\lib\index.js:163:13)
    at errorHandler (C:\Users\...\npm\node_modules\npm\lib\utils\error-handler.js:179:32)
    at Object.<anonymous> (C:\Users\...\npm\node_modules\npm\lib\cli.js:42:14)
    at Object.onceWrapper (events.js:422:26)
    at Object.emit (events.js:315:20)
    at C:\Users\...\npm\node_modules\npm\lib\npm.js:148:12
    Error: call config.load() before reading values
    at Config.get (C:\Users\...\npm\node_modules\npm\node_modules\@npmcli\config\lib\index.js:163:13)
    at process.errorHandler (C:\Users\...\npm\node_modules\npm\lib\utils\error-handler.js:179:32)
    at process.emit (events.js:315:20)
    at processPromiseRejections (internal/process/promises.js:245:33)
    at processTicksAndRejections (internal/process/task_queues.js:94:32)
    C:\Users\...\npm\node_modules\npm\node_modules\@npmcli\config\lib\index.js:163
    throw new Error('call config.load() before reading values')
    ^

    Error: call config.load() before reading values
    at Config.get (C:\Users\...\npm\node_modules\npm\node_modules\@npmcli\config\lib\index.js:163:13)
    at process.errorHandler (C:\Users\...\npm\node_modules\npm\lib\utils\error-handler.js:179:32)
    at process.emit (events.js:315:20)
    at process._fatalException (internal/process/execution.js:163:25)


    Running command npm -v and npm outdated returns the same error.

    I run cmd as administrator.

    Environment Variables

    User variables for ...

    [​IMG]

    System variables

    [​IMG]

    Running command

    C:\Users\...>node --version


    returns

    v14.16.1


    I use Angular 7 and ng build seems to work as usual.

    Continue reading...

Compartilhe esta Página