The issue of npm install failing due to a package.json misconfiguration has been discussed. After a recent commit, npm install fails for dependencies with versions referencing Git repositories instead of semantic version strings, particularly if no package.json file exists in the repository.
kleinfreund reported the issue, and pmusaraj explained that npm install is not supported for development, and yarn install should be used instead. The error is due to the use of Yarn syntax for referencing GitHub versions of dependencies in package.json.
It was suggested to add an entry to package.json to force npm install to fail with a message indicating that only Yarn is supported sam. A possible solution was found joffreyjaffeux, but it was later determined that Yarn and NPM use incompatible syntax for referencing remote Git repositories.
A commit has been made to add a preinstall hook that stops npm install and outputs a message to use Yarn instead pmusaraj. Users are advised to use yarn install for development purposes.
880 silly fetchPackageMetaData error for jquery.autoellipsis@git+https://github.com/pvdspek/jquery.autoellipsis.git premature close
881 silly fetchPackageMetaData error for favcount@git+https://github.com/chrishunt/favcount.git premature close
882 silly fetchPackageMetaData error for jquery-resize@git+https://github.com/cowboy/jquery-resize.git premature close
… installation fails for dependencies whose version is a git repository instead of a semantic version string. In particular, they fail if in the repostitory, there is no package.json file.
I think the error you’re getting is due to our package.json using yarn syntax for referencing Github versions of dependencies. So, use yarn install instead of npm. Also, yarn install is only required for running frontend (qunit) tests or when a developer is upgrading one of the Discourse dependencies listed in package.json.
I did not know that only Yarn is supposed to be used here. I saw a package.json and run npm install a short while ago to run my plugin tests. Now, npm install doesn’t work.
@kleinfreund there is absolutely no need to run npm install. And as Sam and Joffrey point out, we will shortly block running npm install on the repo. (Just use yarn install.)