RepoSense
RepoSense copied to clipboard
DG: Confirm/remove npm prerequisite
https://reposense.org/dg/settingUp.html mentions npm as a prerequisite. @jylee-git asked if it really needed or is npm installed automatically by our build scripts.
We should either confirm it is correct or remove it if npm is installed automatically.
Preliminary steps done thus far:
- Uninstall Node.js and npm.
- Check that npm and node.js is uninstalled with
node -v
andnpm -v
in OS terminal. - Clone repository and completed set up procedure according to https://reposense.org/RepoSense/dg/settingUp.html without node.js and npm installed.
- Run
gradlew clean build
to ensure project is successfully built.
Findings:
- Running
gradlew clean build
producesBUILD SUCCESSFUL
message - Running
gradlew clean build
calls Tasks:downloadNode
andnpmInstall
- NPM has created a node_modules directory
- However, check for npm version fails at the directory in the OS terminal
Conclusion: Currently, npm commands fail via command line upon building the project via gradle without npm prerequisite. Further testing is required to determine if npm prerequisite may be completely removed.
As mentioned in #1720, the npm
used in Gradle is from the ./build/node/
directory, which is within the project itself. However, a manual installation of Node.js and npm would be done on a directory outside of the project, with the PATH
variable set.
The reason why npm commands fail without the npm prerequisite is because the npm installed by Gradle is not added to the system PATH
variable, so outside of Gradle, the terminal has no idea that the npm
command should be found in ./build/node/
.
Despite the automatic installation of npm
through Gradle, I would not recommend removing it entirely from the prerequisites since it may be needed for auditing and updating dependencies in the package.json
files. Setting ./build/node
for the PATH
variable is also not recommended since the build
directory (along with npm
) can be deleted using gradlew clean
.
Closing this issue as investigation of the differences between Gradle npm
and developer-installed npm
is pretty much complete. Whether the npm prerequisite is removed (or modified) depends on how we address #1886