I've created new play framework app using a angular-seed-play-java template. So now I'm trying to install Babel as a transpiler.
Following these instructions I've added sbt-babeljs to my plugins.sbt
https://github.com/stonexx/sbt-babeljs .
Then I want to install bubel-core locally. I got a webjar from the http://www.webjars.org/ and inserted the following line into my build.sbt .
"org.webjars.npm" % "babel-core" % "6.11.4"
I'm getting unresolved dependency error:
[error] (*:update) sbt.ResolveException: unresolved dependency: org.webjars.npm#babel-types;[6.9.1,7): not found
[error] unresolved dependency: org.webjars.npm#babel-template;[6.9.0,7): not found
[error] unresolved dependency: org.webjars.npm#babel-traverse;[6.11.4,7): not found
There is no required version of babel-types at http://www.webjars.org/ . And I get similar problems with some other webjars. I constantly get unresolved dependency errors. How I supposed to solve those?
Thanks in advance.
Hope that you have checked the SBTDependency Documentation for play framework in the official site. Check SBTDocumentation for Resolvers too.
I would recommend you try this 1st before trying all below different solutions that I found online.
Download the buble-core locally as you mentioned and place it in the local .m2 folder to make it available as a local repository.
Let sbt get to know the location of the downloaded webjar by setting it through resolvers like below - sbt can search your local Maven repository if you add it as a repository:
resolvers += (
"Local Maven Repository" at "file:///"+Path.userHome.absolutePath+"/.m2/repository"
)
Hope this should work in your situation, if this didn't work try below solution I found online
Try1
- Install babel-core globally with npm:
npm install babel-core -g
- Then add environment variable called 'NODE_PATH' with value '%AppData%\npm\node_modules'
Try2
Create package.json file in project root and write the below.
{
"devDependencies": {
"babel-core": "^6.2.4"
}
}
then Run "babel" task on sbt console.
Try3
Create [node_modules] directory and download babel-core automatically.
(You don't have to [babel-core] install globally and set environment.)
Source for all these Try-Solutions is this.