node.jsnpm

Why does npm keep giving out "Invalid property 'node'"?


I have an issue where I'm trying to use npm in VSCode but I keep running into the same error message. I'm currently using the Electron React Boilerplate and Windows 10 if that helps. It doesnt seem to matter which npm command I'm using, I tried npm install npm start npm help but the error still remains.

npm error Invalid property "node"   

I'm also going to add the log file which it keeps spitting out

0 verbose cli C:\Program Files\nodejs\node.exe C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js
1 info using npm@10.9.0
2 info using node@v22.11.0
3 silly config load:file:C:\Program Files\nodejs\node_modules\npm\npmrc
4 silly config load:file:D:\Workspaces\ToDo Quest\todo-quest\.npmrc
5 silly config load:file:C:\Users\kevlo\.npmrc
6 silly config load:file:C:\Users\kevlo\AppData\Roaming\npm\etc\npmrc
7 verbose title npm help
8 verbose argv "help"
9 verbose logfile logs-max:10 dir:C:\Users\kevlo\AppData\Local\npm-cache\_logs\2024-11-19T18_02_40_942Z-
10 verbose logfile C:\Users\kevlo\AppData\Local\npm-cache\_logs\2024-11-19T18_02_40_942Z-debug-0.log
11 silly logfile start cleaning logs, removing 1 files
12 silly logfile done cleaning log files
13 verbose stack Error: Invalid property "node"
13 verbose stack     at checkDevEngines (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-install-checks\lib\dev-engines.js:100:13)
13 verbose stack     at Help.checkDevEngines (C:\Program Files\nodejs\node_modules\npm\lib\base-cmd.js:153:22)
13 verbose stack     at async #exec (C:\Program Files\nodejs\node_modules\npm\lib\npm.js:251:7)
13 verbose stack     at async Npm.exec (C:\Program Files\nodejs\node_modules\npm\lib\npm.js:207:9)
13 verbose stack     at async module.exports (C:\Program Files\nodejs\node_modules\npm\lib\cli\entry.js:74:5)
14 error Invalid property "node"
15 verbose cwd D:\Workspaces\ToDo Quest\todo-quest
16 verbose os Windows_NT 10.0.19045
17 verbose node v22.11.0
18 verbose npm  v10.9.0
19 verbose exit 1
20 verbose code 1
21 error A complete log of this run can be found in: C:\Users\kevlo\AppData\Local\npm-cache\_logs\2024-11-19T18_02_40_942Z-debug-0.log

I've tried to reinstall node.js several times, but without success


Solution

  • This is a bug in the boilerplate.

    NPM 10.9.0 introduced a breaking change by forcing the check of devEngines entry.

    This boilerplate uses the deprecated format that is similar to engines, the specified versions imply when it was added:

      "devEngines": {
        "node": ">=14.x",
        "npm": ">=7.x"
      },
    

    A different format is expected for devEngines in NPM 10.9.0. It cannot be ignored with --force, which can work only for the supported format.

    The fix is to rename devEngines to engines in package.json, or remove it at all, since it doesn't serve a practical purpose with the specified versions.