-
Notifications
You must be signed in to change notification settings - Fork 8
Open
Description
I was getting the following errors when I tried to run this:
PS C:\Tools\Nodejs-Tracer-main > node -r tracer.js C:\PATH\TO\FILE.js
node:internal/modules/package_json_reader:111
const result = modulesBinding.getNearestParentPackageJSON(checkPath);
^
Error: Invalid package config \\?\C:\Tools\Nodejs-Tracer-main\package.json.
at Object.getNearestParentPackageJSON (node:internal/modules/package_json_reader:111:33)
at trySelf (node:internal/modules/cjs/loader:591:33)
at Function._resolveFilename (node:internal/modules/cjs/loader:1226:24)
at Function._load (node:internal/modules/cjs/loader:1075:27)
at TracingChannel.traceSync (node:diagnostics_channel:322:14)
at wrapModuleLoad (node:internal/modules/cjs/loader:219:24)
at Module.require (node:internal/modules/cjs/loader:1340:12)
at node:internal/modules/cjs/loader:1843:12
at loadPreloadModules (node:internal/process/pre_execution:727:5)
at setupUserModules (node:internal/process/pre_execution:206:5) {
code: 'ERR_INVALID_PACKAGE_CONFIG'
}
Node.js v22.12.0
Then I realized the package.json file has a trailing comma after "license":"MIT":
{
"name": "Nodejs-tracer",
"version": "1.0.0",
"description": "Simple Node.jstracer that logs calls to core modules",
"main": "tracer.js",
"scripts": {
"start": "node -r .\tracer.js main.js",
"test": "echo \"No tests specified\" && exit 0"
},
"keywords": ["node", "tracer", "main"],
"author": "Sven Rath",
"license": "MIT",
}
After removing this, the script runs without errors.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels