简体   繁体   中英

Gradle NPM node error (npm' is not recognized as an internal or external command)

How does gradle recognize npm commands?

I am getting this exception from gradle build task

npm' is not recognized as an internal or external command

Preconditions:

I have installed node locally on a windows machine. NPM command is working through the command line, but while running gradle build file from command or IDE I am getting that exception.

  1. Verify you have npm installed (it should live in your nodejs program folder)
  2. If you don't find a file called "npm" in there, (re)install node by downloading and running the nodejs msi file (npm comes with it)
  3. Add your node.js's program folder to your systems path and restart your command line.

When you run gradle from your IDE, you are using a different path than when you run it from the command line. If you run the gradle task with --stacktrace and --debug, it should output the path it is using. You will need to set the path for your IDE according to OS/IDE instructions.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM