bryncooke / babel-gradle Goto Github PK
View Code? Open in Web Editor NEWBabel Gradle plugin
License: Apache License 2.0
Babel Gradle plugin
License: Apache License 2.0
Hi there, I'm having an issue where Gradle/Java is not to be able to find the "npx" executable, even though it is in a directory that is listed on the PATH. I can run npx fine from the good old cmd, without having to use an absolute path. I did all the restarting, computer restarting and such things to make sure that the potentially new PATH is recognized everywhere already, to no avail.
I'm not really sure where to post this issue, because it also seems to perhaps be an issue of Gradle in general. I'm posting this here right now because I have just managed to modify your plugin locally into a version that bypasses this issue, and I don't have any experience with issue reporting for Gradle yet.
My fix is basically, on Windows (through OS detection), instead of calling npx directly in BabelTask.groovy, to prefix the command with "cmd /C". Cmd strangely enough can be found by Gradle. So the command becomes something like
cmd /C npx babel-cli index.js and so on..
I can understand if you decide that this is not an issue of this project, but if you do want to fix it yourself until perhaps something changes with Gradle, I can make a pull request if you want. I already got the code here for myself anyway.
Also, on another note; when running "npx babel" manually it says the following;
C:\Users\Martijn\AppData\Roaming\npm-cache\_npx\5504\node_modules\babel\lib\cli.js
You have mistakenly installed the `babel` package, which is a no-op in Babel 6.
Babel's CLI commands have been moved from the `babel` package to the `babel-cli` package.
npm uninstall babel
npm install --save-dev babel-cli
See http://babeljs.io/docs/usage/cli/ for setup instructions.
In my modified version I changed the "babel" command to "babel-cli" for precisely this reason, it would not work otherwise.
System specifications:
NodeJS v9.11.1
npx v9.7.1
npm v5.0.4
java version "1.8.0_161"
Java(TM) SE Runtime Environment (build 1.8.0_161-b12)
Java HotSpot(TM) 64-Bit Server VM (build 25.161-b12, mixed mode)
------------------------------------------------------------
Gradle 4.6
------------------------------------------------------------
Build time: 2018-02-28 13:36:36 UTC
Revision: 8fa6ce7945b640e6168488e4417f9bb96e4ab46c
Groovy: 2.4.12
Ant: Apache Ant(TM) version 1.9.9 compiled on February 2 2017
JVM: 1.8.0_161 (Oracle Corporation 25.161-b12)
OS: Windows 10 10.0 amd64
Microsoft Windows 10 Pro
Windows version: 10.0.16299 Build 16299
Running on amd64
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.