Error installing ‘sp-pnp-js’ due to fsevents

I was recently upgrading my local version of the SharePoint Framework, so that I could get the latest Release Candidate (RC) for the SharePoint Framework extensions. While doing this, I decided to go ahead and get the latest version of all of the related modules, by issuing the following:

npm install -g npm yo gulp @microsoft/generator-sharepoint

Running the above updated my version of npm to 5.4.0, as shown below:

After running this command, and creating a new SharePoint Framework Extensions project, I went to install sp-pnp-js via:

npm install sp-pnp-js

However, after a lot of churning, I was greeted with an error message complaining about the package.json file in the node_modules directory underneath the fsevents module, which is located in the root node_modules folder. I knew the message ‘Please try running this command again as root/Administrator’ wouldn’t help, since I was already running my command window as an Administrator.

Upon seeing this, I contacted my colleague and friend, Chris Kent, to see if he had seen this error, and we quickly compared version numbers on all of our modules, where we saw I was using NPM 5.4.0, while he was using NPM 3.10.10. Chris then mentioned that the SharePoint Framework is not compatible with NPM 5.x, and upon checking the Setup Documentation I saw a note about the NPM 5.x incompatibility. I setup my environment quite awhile ago, so I’m not sure if that was a recent add to the documentation, but that was my issue, and the resolution was immediately apparent.

npm install -g npm@3.10.10

Upon issuing that command, I reverted my NPM to v3.10.10, and all worked again as expected. If you came across this post after getting a similar error message, hopefully you found this relatively quickly, and it solved your problem as well!


Add a Comment

Your email address will not be published. Required fields are marked *