Plesk

Installing Node.js application dependencies on Plesk for Linux server ends with warning: You must install peer dependencies yourself

Symptoms

Installing Node.js application dependencies in Plesk in Domains > example.com > Node.js > NPM install ends with one or few warnings like the below one:

npm WARN ajv-keywords@2.1.1 requires a peer of ajv@^5.0.0 but none is installed. You must install peer dependencies yourself.

Cause

Expected behavior - the automatic installation of the peer dependencies was removed in npm 3.

Resolution

Use one of the solutions:

Solution 1

  1. Connect to the server using SSH under the subscription's system user.

  2. Manually install the required peer dependencies:

    # npm install --save-dev ajv

    • Replace npm with /opt/plesk/node/XX/bin/npm, where XX is the Node.js version.
    • Replace ajv with the name of the dependency from the warning message.

Solution 2

  1. Log in to Plesk.

  2. Add all required peer dependencies into your application's file package.json in Domains > example.com > File Manager.

  3. Click NPM install in Domains > example.com > Node.js once again.

Note: If the file package.json is a part of a third-party application, please contact the application developers so they fix the content of package.json.