Can't update modules: npm ERR! Cannot read property 'extraneous' of undefined

Hi, I got this error under Windows installation, I've google it but there is no certain way to solve it. Somebody say to remove the package "lock" (I did), someone else to remove the bin folder, others to remove completely the node modules folder.
I tried a npm prune.
I'm afraid to loose Node red, flow and plette installed. How can I solve it? Thank you

What exactly are you doing when the error happens and where does it appear?

Thanks for help, when I'm installing under plette or update a module, I click to see the log and it appears. I?m under windows, npm, python, nodes and node red are up to date

Can you try an install in a terminal please. Go to your .node-red folder and run
npm install node-red-some-node
and copy/paste the full result here. Replace the node name with a real node of course.

So, I made a few test, here the result:
First this was the log in the console:

10 Apr 17:16:53 - [warn] ------------------------------------------
Error: Install failed
at C:\Users\Admin\AppData\Roaming\npm\node_modules\node-red\node_modules@node-red\registry\lib\installer.js:214:23
at runMicrotasks ()
at processTicksAndRejections (internal/process/task_queues.js:97:5)
10 Apr 17:16:53 - [error] Error: Install failed
10 Apr 17:19:02 - [info] Installing module: node-red-contrib-timerswitch, version: 1.3.0
10 Apr 17:19:05 - [warn] Installation of module node-red-contrib-timerswitch failed:
10 Apr 17:19:05 - [warn] ------------------------------------------
10 Apr 17:19:05 - [warn] npm ERR! Cannot read property 'extraneous' of undefined

Then I installed manually as you suggested, in the node modules:
C:\Users\Admin\AppData\Roaming\npm\node_modules\node-red\node_modules>npm install node-red-contrib-timerswitch
npm WARN deprecated bcrypt@3.0.6: versions < v5.0.0 do not handle NUL in passwords properly
npm WARN deprecated node-pre-gyp@0.12.0: Please upgrade to @mapbox/node-pre-gyp: the non-scoped node-pre-gyp package is deprecated and only the @mapbox scoped package will recieve updates in the future

added 1 package, and audited 306 packages in 5s

7 packages are looking for funding
run npm fund for details

3 moderate severity vulnerabilities

To address all issues (including breaking changes), run:
npm audit fix --force

Run npm audit for details.

THen I reloaded the page in browser bu I can't see the node, in palette I still have install and if I install again the same error, on log:
10 Apr 19:01:48 - [info] Installing module: node-red-contrib-timerswitch, version: 1.3.0
10 Apr 19:01:51 - [warn] Installation of module node-red-contrib-timerswitch failed:
10 Apr 19:01:51 - [warn] ------------------------------------------
10 Apr 19:01:51 - [warn] npm ERR! Cannot read property 'extraneous' of undefined

npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Admin\AppData\Local\npm-cache_logs\2021-04-10T16_01_51_169Z-debug.log

10 Apr 19:01:51 - [warn] ------------------------------------------
Error: Install failed
at C:\Users\Admin\AppData\Roaming\npm\node_modules\node-red\node_modules@node-red\registry\lib\installer.js:214:23
at runMicrotasks ()
at processTicksAndRejections (internal/process/task_queues.js:97:5)
10 Apr 19:01:51 - [error] Error: Install failed

May you also kindly describe me what this is for and how can I solve it, thank you :slight_smile:
Please upgrade to @mapbox/node-pre-gyp: the non-scoped node-pre-gyp package is deprecated and only the @mapbox scoped package will recieve updates in the future

Where did I suggest installing it from there. Do it from your .node-red folder. Start by uninstalling it, using npm uninstall, in case it is half installed, then do the install again and post the full install log please.

I don't know where is the folder .node-red , I'm under Windows and I have the folder node-red: C:\Users\Admin\AppData\Roaming\npm\node_modules\node-red

It shows you where it is when you start node-red.

Sorry, you were right:
C:\Users\Admin.node-red>npm install node-red-contrib-timerswitch
npm ERR! Cannot read property 'extraneous' of undefined

npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Admin\AppData\Local\npm-cache_logs\2021-04-10T16_20_52_098Z-debug.log

C:\Users\Admin.node-red>npm uninstall node-red-contrib-timerswitch
npm ERR! Cannot read property 'extraneous' of undefined

npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Admin\AppData\Local\npm-cache_logs\2021-04-10T16_21_04_446Z-debug.log

C:\Users\Admin.node-red>

I see, npm won't run at all in that folder. Odd. Something must be messed up.
You said you had already tried deleting package-lock.json, was it the one in the .node-red folder you deleted? If not then try that, you won't lose anything by doing that. You should be backing up that folder anyway if your flows are important.
If deleting package-lock doesn't fix it then please post here the file package.json which should be in your .node-red folder.

Edit. Use the </> button at the top of the forum entry window and paste it in where it says. That will stop the forum from interpreting it as Markdown.

Further edit. If package-lock removal doesn't help then also remove .node-red/node_modules folder. You won't lose anything important. Having deleted them, then in .node-red again run
npm install
with no node specified. That will rebuild node_modules.

I've deleted that folder, then under .ned-rode I executed with administrative privileges:

C:\Users\Admin\.node-red>npm install
npm ERR! Cannot read property 'extraneous' of undefined

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Admin\AppData\Local\npm-cache\_logs\2021-04-10T16_39_52_457Z-debug.log

And package-lock.json?
Post package.json as I asked.

now also that, but

C:\Users\Admin\.node-red>npm install
npm ERR! must provide realpath for Link node

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Admin\AppData\Local\npm-cache\_logs\2021-04-10T16_43_30_902Z-debug.log

C:\Users\Admin\.node-red>

{
    "name": "node-red-project",
    "description": "A Node-RED Project",
    "version": "0.0.1",
    "private": true,
    "dependencies": {
        "@serdoo/node-red-contrib-chatbot": "~0.18.26",
        "node-red-contrib-amazon-echo": "~0.1.10",
        "node-red-contrib-simpletime": "~2.10.0",
        "node-red-contrib-telegrambot": "file:node_modules/node-red-contrib-telegrambot",
        "node-red-node-email": "~1.7.8"
    }
}

That is the problem. Somehow you have tried to install that in a strange way. Make a copy of that file (package.json), just in case, and then delete that line and run npm install again. Assuming that goes ok then restart node-red and if necessary install telegrambot using Manage Palette.

thank you for your kind help :slight_smile:
I don't know how it happened..

How can I upgrade all of them? Manually each one?

npm WARN deprecated har-validator@5.1.5: this library is no longer supported
npm WARN deprecated chokidar@2.1.8: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.
npm WARN deprecated socks@1.1.10: If using 2.x branch, please upgrade to at least 2.1.6 to avoid a serious bug with socket data flow and an import issue introduced in 2.1.0
npm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
npm WARN deprecated request-promise@4.2.6: request-promise has been deprecated because it extends the now deprecated request package, see https://github.com/request/request/issues/3142
npm WARN deprecated node-pre-gyp@0.16.0: Please upgrade to @mapbox/node-pre-gyp: the non-scoped node-pre-gyp package is deprecated and only the @mapbox scoped package will recieve updates in the future
npm WARN deprecated node-pre-gyp@0.11.0: Please upgrade to @mapbox/node-pre-gyp: the non-scoped node-pre-gyp package is deprecated and only the @mapbox scoped package will recieve updates in the future
npm WARN deprecated @types/p-retry@3.0.1: This is a stub types definition. p-retry provides its own type definitions, so you do not need this installed.
npm WARN deprecated @types/form-data@2.5.0: This is a stub types definition. form-data provides its own type definitions, so you do not need this installed.
npm WARN deprecated @types/p-cancelable@1.0.1: This is a stub types definition. p-cancelable provides its own type definitions, so you do not need this installed.
npm WARN deprecated axios@0.18.1: Critical security vulnerability fixed in v0.21.1. For more information, see https://github.com/axios/axios/pull/3410
npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated core-js@2.6.12: core-js@<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js@3.

I also got lot of errors

pm ERR! code 1
npm ERR! path C:\Users\Admin\.node-red\node_modules\sqlite3
npm ERR! command failed
npm ERR! command C:\WINDOWS\system32\cmd.exe /d /s /c node-pre-gyp install --fallback-to-build
npm ERR! Failed to execute 'C:\Program Files\lavoro\nodejs\node.exe C:\Users\Admin\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js configure --fallback-to-build --module=C:\Users\Admin\.node-red\node_modules\sqlite3\lib\binding\node-v83-win32-x64\node_sqlite3.node --module_name=node_sqlite3 --module_path=C:\Users\Admin\.node-red\node_modules\sqlite3\lib\binding\node-v83-win32-x64 --napi_version=6 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v83' (1)
npm ERR! node-pre-gyp info it worked if it ends with ok
npm ERR! node-pre-gyp info using node-pre-gyp@0.11.0
npm ERR! node-pre-gyp info using node@14.4.0 | win32 | x64
npm ERR! node-pre-gyp WARN Using request for node-pre-gyp https download
npm ERR! node-pre-gyp info check checked for "C:\Users\Admin\.node-red\node_modules\sqlite3\lib\binding\node-v83-win32-x64\node_sqlite3.node" (not found)
npm ERR! node-pre-gyp http GET https://mapbox-node-binary.s3.amazonaws.com/sqlite3/v4.2.0/node-v83-win32-x64.tar.gz
npm ERR! node-pre-gyp http 403 https://mapbox-node-binary.s3.amazonaws.com/sqlite3/v4.2.0/node-v83-win32-x64.tar.gz
npm ERR! node-pre-gyp WARN Tried to download(403): https://mapbox-node-binary.s3.amazonaws.com/sqlite3/v4.2.0/node-v83-win32-x64.tar.gz
npm ERR! node-pre-gyp WARN Pre-built binaries not found for sqlite3@4.2.0 and node@14.4.0 (node-v83 ABI, unknown) (falling back to source compile with node-gyp)
npm ERR! node-pre-gyp http 403 status code downloading tarball https://mapbox-node-binary.s3.amazonaws.com/sqlite3/v4.2.0/node-v83-win32-x64.tar.gz
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp@7.1.2
npm ERR! gyp info using node@14.4.0 | win32 | x64
npm ERR! gyp info ok
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp@7.1.2
npm ERR! gyp info using node@14.4.0 | win32 | x64
npm ERR! gyp info find Python using Python version 3.9.4 found at "C:\Users\Admin\AppData\Local\Programs\Python\Python39\python.exe"
npm ERR! gyp ERR! find VS
npm ERR! gyp ERR! find VS msvs_version not set from command line or npm config
npm ERR! gyp ERR! find VS VCINSTALLDIR not set, not running in VS Command Prompt
npm ERR! gyp ERR! find VS could not use PowerShell to find Visual Studio 2017 or newer, try re-running with '--loglevel silly' for more details
npm ERR! gyp ERR! find VS looking for Visual Studio 2015
npm ERR! gyp ERR! find VS - not found
npm ERR! gyp ERR! find VS not looking for VS2013 as it is only supported up to Node.js 8
npm ERR! gyp ERR! find VS
npm ERR! gyp ERR! find VS **************************************************************
npm ERR! gyp ERR! find VS You need to install the latest version of Visual Studio
npm ERR! gyp ERR! find VS including the "Desktop development with C++" workload.
npm ERR! gyp ERR! find VS For more information consult the documentation at:
npm ERR! gyp ERR! find VS https://github.com/nodejs/node-gyp#on-windows
npm ERR! gyp ERR! find VS **************************************************************
npm ERR! gyp ERR! find VS
npm ERR! gyp ERR! configure error
npm ERR! gyp ERR! stack Error: Could not find any Visual Studio installation to use
npm ERR! gyp ERR! stack     at VisualStudioFinder.fail (C:\Users\Admin\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:121:47)
npm ERR! gyp ERR! stack     at C:\Users\Admin\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:74:16
npm ERR! gyp ERR! stack     at VisualStudioFinder.findVisualStudio2013 (C:\Users\Admin\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:351:14)
npm ERR! gyp ERR! stack     at C:\Users\Admin\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:70:14
npm ERR! gyp ERR! stack     at C:\Users\Admin\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\find-visualstudio.js:372:16
npm ERR! gyp ERR! stack     at C:\Users\Admin\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\util.js:54:7
npm ERR! gyp ERR! stack     at C:\Users\Admin\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\util.js:33:16
npm ERR! gyp ERR! stack     at ChildProcess.exithandler (child_process.js:310:5)
npm ERR! gyp ERR! stack     at ChildProcess.emit (events.js:315:20)
npm ERR! gyp ERR! stack     at maybeClose (internal/child_process.js:1051:16)
npm ERR! gyp ERR! System Windows_NT 10.0.18363
npm ERR! gyp ERR! command "C:\\Program Files\\lavoro\\nodejs\\node.exe" "C:\\Users\\Admin\\AppData\\Roaming\\npm\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "configure" "--fallback-to-build" "--module=C:\\Users\\Admin\\.node-red\\node_modules\\sqlite3\\lib\\binding\\node-v83-win32-x64\\node_sqlite3.node" "--module_name=node_sqlite3" "--module_path=C:\\Users\\Admin\\.node-red\\node_modules\\sqlite3\\lib\\binding\\node-v83-win32-x64" "--napi_version=6" "--node_abi_napi=napi" "--napi_build_version=0" "--node_napi_label=node-v83"
npm ERR! gyp ERR! cwd C:\Users\Admin\.node-red\node_modules\sqlite3
npm ERR! gyp ERR! node -v v14.4.0
npm ERR! gyp ERR! node-gyp -v v7.1.2
npm ERR! gyp ERR! not ok
npm ERR! node-pre-gyp ERR! build error
npm ERR! node-pre-gyp ERR! stack Error: Failed to execute 'C:\Program Files\lavoro\nodejs\node.exe C:\Users\Admin\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js configure --fallback-to-build --module=C:\Users\Admin\.node-red\node_modules\sqlite3\lib\binding\node-v83-win32-x64\node_sqlite3.node --module_name=node_sqlite3 --module_path=C:\Users\Admin\.node-red\node_modules\sqlite3\lib\binding\node-v83-win32-x64 --napi_version=6 --node_abi_napi=napi --napi_build_version=0 --node_napi_label=node-v83' (1)
npm ERR! node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (C:\Users\Admin\.node-red\node_modules\sqlite3\node_modules\node-pre-gyp\lib\util\compile.js:83:29)
npm ERR! node-pre-gyp ERR! stack     at ChildProcess.emit (events.js:315:20)
npm ERR! node-pre-gyp ERR! stack     at maybeClose (internal/child_process.js:1051:16)
npm ERR! node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:287:5)
npm ERR! node-pre-gyp ERR! System Windows_NT 10.0.18363
npm ERR! node-pre-gyp ERR! command "C:\\Program Files\\lavoro\\nodejs\\node.exe" "C:\\Users\\Admin\\.node-red\\node_modules\\sqlite3\\node_modules\\node-pre-gyp\\bin\\node-pre-gyp" "install" "--fallback-to-build"
npm ERR! node-pre-gyp ERR! cwd C:\Users\Admin\.node-red\node_modules\sqlite3
npm ERR! node-pre-gyp ERR! node -v v14.4.0
npm ERR! node-pre-gyp ERR! node-pre-gyp -v v0.11.0
npm ERR! node-pre-gyp ERR! not ok

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Admin\AppData\Local\npm-cache\_logs\2021-04-10T16_59_49_267Z-debug.log

The error is quite clear...

You need to install build tools first. From an elevated command prompt...

npm install --global windows-build-tools

Don't worry about it, they are all modules pulled in by the nodes, it is up to the author of those to sort that out.

Thnaks, I launched that command and waited patentially. After 10 minutes it was downloading I had a look what exactly.. tons and tons of SDK, sorry I don't need them, they will fill up my SSD for nothing. I closed the process.
I'll check about the issue with visual studio