sinopia icon indicating copy to clipboard operation
sinopia copied to clipboard

Publishing package with missing fields in package.json causes crash

Open vladimirivanoviliev opened this issue 8 years ago • 0 comments

Publishing package with missing fields (e.g.: "description", "main") causes Sinopia to crash due to the use of these fields in the index page template.

TypeError: Cannot read property 'name' of undefined
   at Object.<anonymous> (/opt/sinopia/node_modules/sinopia/lib/index-web.js:41:65)

At the same time public npm repository automatically add the missing fields with their default values to the package.json. Either making the template accept null values or filling the missing values with their default values will help avoiding unnecessary Sinopia crashes.

The above error was fixed with adding the following lines to the package.json:

 +  "description": "foo",
 +  "main": "js/core.js",
 +  "author": "bar",

vladimirivanoviliev avatar Jul 26 '16 12:07 vladimirivanoviliev