RepoSense icon indicating copy to clipboard operation
RepoSense copied to clipboard

DG: Confirm/remove npm prerequisite

Open damithc opened this issue 4 years ago • 2 comments

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.

damithc avatar Jun 11 '20 04:06 damithc

Preliminary steps done thus far:

  1. Uninstall Node.js and npm.
  2. Check that npm and node.js is uninstalled with node -v and npm -v in OS terminal.
  3. Clone repository and completed set up procedure according to https://reposense.org/RepoSense/dg/settingUp.html without node.js and npm installed.
  4. Run gradlew clean build to ensure project is successfully built.

Findings:

  • Running gradlew clean build produces BUILD SUCCESSFUL message image
  • Running gradlew clean build calls Tasks: downloadNode and npmInstall image
  • NPM has created a node_modules directory image
  • However, check for npm version fails at the directory in the OS terminal image

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.

rolandyuwy avatar Dec 17 '20 15:12 rolandyuwy

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.

yhtMinceraft1010X avatar Apr 28 '22 03:04 yhtMinceraft1010X

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

yhtMinceraft1010X avatar Feb 04 '23 15:02 yhtMinceraft1010X