Upgraded to 0.6.13 and now node can't find module moment - scala.js

I have a Play project that uses scala.js. Tests all ran fine until I upgraded the scala.js plugin to 0.6.13. Now I get "Error: Cannot find module '../moment'".
I read on the 0.6.13 release notes that run and test now use node.js by default; I'm sure that change is the root of my problem.
I see the note to install jsdom using "npm install jsdom" either locally or globally. I first tried installing the moment library globally (npm install -g moment). No change, so I tried installing in the project's root directory. Still no change.
Suggestions?

I updated the moment.js facade from "io.github.widok" %%% "scala-js-momentjs" % "0.2.0" to "ru.pavkin" %%% "scala-js-momentjs" % "0.4.1". Changed relevant import statements and recompiled. Tests passed.
Removed the node_modules directory from the app's root directory. Tests failed with the earlier error. Reinstalled the moment library (npm install moment) and tests pass again.

Related

Install sbt from source

Because in my operating system distribution has not default package sbt, I try compile from source and install sbt package locally (https://github.com/sbt/sbt). Unfortunately I can not do it and I can not find any guide to do this without installed sbt. To compile sbt from source is needed sbt? What can I to do to install sbt from source?
The answer is yes: to build sbt from source, you need to install sbt first (obviously, not from source). There are instructions for Building sbt from source and they start with
Install the current stable binary release of sbt (see Setup), which will be used to build sbt from source.
If you have a concrete problem installing sbt from binaries, you should solve it first. You can ask for help with it in a new question.

Play: bower webjars not loaded into target folder

I have a play 2.4 subproject that uses sbt-sassify. It works fine, but I want to pull a bower dependency into the project so that my scss files can make use of it. I followed the sbt-sassify instructions for this and added the following dependency to my build.sbt.
"org.webjars.bower" % "bootstrap-sass" % "3.3.6"
However, when I run the project, none of the scss from bootstrap-sass is in the target folder so that I'm able to import it into my scss. If I use a dependency to a classic webjar such as
"org.webjars" % "bootstrap" % "3.3.6"
I will be able to see the bootstrap code in target/public/main/lib.
When I run the sbt-dist command, the bower jars will show up in my universal tar ball.
Is there anything else I need to configure?
activator dist will only package your project in several jars. The contents of all assets can be found in:
target/scala_<scala_version>/<prefix>-web-assets.jar/public/lib/bootstrap-sass
However, none of this makes sense when you're only trying to import the scss files into your own scss files. As of sbt-sassify version 1.4.0+ you can include web-jarred assets into your own files (without relying on the folder structure of your application).
I'm not sure which of the bootstrap files you're trying to import, but for instance if you'd want to the root of the bootstrap code you could use
#import "lib/bootstrap-sass/assets/stylesheets/bootstrap";
P.S.
I'm the author of sbt-sassify and I've tested this with play 2.4.6 and sbt-sassify version 1.4.2. In case this does not solve things for you, can you create a repo on github exhibiting the faulty behaviour?

Installing SBT on Win 7 64 bit

I want to install Apache Spark for testing purpose. For that I found out that Scala and sbt are necessary. I downloaded scala msi and installed it. For installing sbt I tried various methods but am unable to do so. Can someone tell me what am I doing wrong. What I did is
Install Scala msi
Download sbt msi and install it.
Set sbt_home and path variable to the location where sbt is extracted. Then I opened cmd to check my sbt version by using sbt sbt-version I am getting the following error **unresolved dependency:
org.fusesource.jansi#jansi;1.11: not found
Error during sbt execution: Error retrieving required libraries (see C:\Users\ashish-b\.sbt\boot\update.log for complete log) Error: Could not retrieve jansi 1.11 **
Whats wrong in it?
I saw this issue as well when connecting to the internet via a corporate proxy. In this case, sbt couldn't download its dependencies.
We work with a proxy Maven repository for depedencies. Configure sbt to use a proxy repo.
Our sbt repositories file looks like this:
[repositories]
local
local-maven: file:///C:/data/maven_repo/
aaa-ext-ivy-proxy: http://nexus-ext.company.net:8081/nexus/content/groups/ivy-public/, [organization]/[module]/(scala_[scalaVersion]/)(sbt_[sbtVersion]/)[revision]/[type]s/[artifact](-[classifier]).[ext]
aaa-ext-maven-proxy: http://nexus-ext.company.net:8081/nexus/content/groups/public/
aaa-int-maven-repo: http://nexus-int.company.net:8081/nexus/content/groups/public/
Or you can also configure the proxy server directly for SBT, see this question.

Enable sbt plugin in IntelliJ IDEA 14

I am trying to use the SBT dotenv plugin with IntelliJ IDEA 14. I have only the Scala plugin installed (it seems SBT plugin is not there anymore). The IDEA project is imported from build.sbt.
I added the code from the SBT dotenv Readme to my project/plugins.sbt. I also added project/build.properties to specify SBT version 0.13.6.
When I run sbt console in my terminal it properly loads my .env file and I can access the ENV vars with sys.get("NAME"). However in IDEA, it will not load the vars. I test with adding sys.get("NAME") to one of my tests and run it. I tried restarting IDEA but it does not help. Also tried adding project/.env in addition to .env but it did not help.
If you look at the sources of the dotenv plugin it does something it calls DirtyEnvironmentHack.setEnv which probably just works in a shell because it is a hack. I would guess this explains the environment isn't changed when loaded in IntelliJ.

Sbt 0.12.4+ required on project import

I'm currently reading the Play for Scala: Covers Play 2 book by Peter Hilton (publisher: Manning) , and trying to stick to the versions they've outlined in the book (Play version 2.1.1).
I downloaded the new IntelliJ IDEA 14 CE app and installed it. I'm currently importing the project, and it's failing because it wants a version of sbt that is 0.12.4 or greater.
This issue occurred in 13 the other day, but I haven't had time to resolve it, so please, no recommendations to go back to 13 :)
Here is the meat of the issue:
When I type sbt --version on the CLI, it prints sbt launcher version 0.13.6. I have a "greater" version, but it appears that IDEA doesn't recognize this.
In an effort to specify my own SBT launcher JAR, I pointed my custom launcher (in IDEAs global settings) to the one in /usr/local/Cellar/sbt/0.13.6/libexec/sbt-launch.jar, but the build also failed with the same error.
As you may have guessed at this point, I have used Homebrew to install and manage Scala and sbt. When I first started working with Scala back in February, I remember having to make a few small tweaks in my settings to get IDEA to find Scala, but my version of IDEA 14 is totally fresh -- I did not import any previous settings. I downloaded the Scala and sbt plugins and they appear to be properly configured after a cursory look and creation of a new test project.
Here is what I'm failing to understand:
First, and most obvious, why would an sbt version that meets the supposed requirement (0.12.4+) fail with version 0.13.*?
Second, is the bundled sbt with IDEA also greater than this version? Is there possibly an sbt flag somewhere in my system that's pointing it to an earlier version? A side note, I have a few versions of sbt in my "Cellar", but all are greater than 0.13.
Many thanks for your help!
I had a look at the code samples from Manning's website, and the project/build.properties files for each project specify sbt.version=0.12.2. My guess is that the Intellij Scala plugin only supports SBT 0.12.4, and cannot import you project which is configured to use an older version (hence why it recommends that you "update your project definition").
You should try using sbt.version=0.12.4 in the project/build.properties file.
Generally speaking, keep in mind that when an SBT version is specified in project/build.properties, the SBT launcher downloads the specified version and uses it to build the project. In your case, that means that the SBT 0.13.6 launcher will download SBT 0.12.2 and use that version to build the project.