Expand Minimize

Project should list its dependencies in package.json or as external resources

Project should list the packages it depends on in the package.json file or as external resources

CheckId SPF050102
TypeName ProjectDependenciesAreRegistered
Severity Error
Type Project

When building SharePoint Framework projects you might need additional packages. These packages are installed using npm. When installing these packages you should use the -S (short for --save) parameter. That way, when your colleagues get the project from the source control and build it, they won't be missing any dependencies.

Installing angular with npm and saving it in the list of dependencies

$ npm i angular -S

Sometimes, rather than installing additional packages in your project you might want to load them from a CDN or some other location. In such cases the external package should be registered with the project in its configuration file:

jQuery registered as an external package in the 'config/config.json' file:
  "entries": [
      "entry": "./lib/webparts/weather/WeatherWebPart.js",
      "manifest": "./src/webparts/weather/WeatherWebPart.manifest.json",
      "outputPath": "./dist/weather.bundle.js"
  "externals": {
    "jquery": "https://code.jquery.com/jquery-2.1.1.min.js"
  "localizedResources": {
    "weatherStrings": "webparts/weather/loc/{locale}.js"

To suppress this violation in XML SharePoint code add the following comment right before the XML tag which causes the rule violation. Learn more about SuppressMessage here.

<!-- "SuppressMessage":{"rule":"SPF050102:ProjectDependenciesAreRegistered","justification":"Provide reason for suppression here"} -->
Disclaimer: The views and opinions expressed in this documentation and in SPCAF do not necessarily reflect the opinions and recommendations of Microsoft or any member of Microsoft. SPCAF and RENCORE are registered trademarks of Rencore. All other trademarks, service marks, collective marks, copyrights, registered names, and marks used or cited by this documentation are the property of their respective owners.