LESS file watcher gives SyntaxError: Unexpected token during compilation - less

I have set up a LESS file watcher in Webstorm 9.0.2 to take my main.less file and compile it to main.css every time I save edits.
This is how I set it up:
This is what is in my main.less file
body {color:#fff}
However I get the following error in console during my compilation phase:
"C:/Program Files/nodejs/node.exe" main.less
E:\Ornico Work\socialdashboardAngular\app\styles\main.less:1
(function (exports, require, module, __filename, __dirname) { body {
^
SyntaxError: Unexpected token {
at Module._compile (module.js:439:25)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Function.Module.runMain (module.js:497:10)
at startup (node.js:119:16)
at node.js:906:3
Process finished with exit code 8
I am new to Webstorm and have very little idea what that error means and how to fix it. Could anyone out there please help me with this if at all possible?

Why do you use node.js to compile your .less files? Node itself can't do this - you need installing LESS compiler (npm install less -g) and specify a path to it as a program in your LESS file watcher.
Like:
Program: C:\Users\Your.Name\AppData\Roaming\npm\lessc.cmd
Arguments: --no-color $FileName$
Workingh dir: $FileDir$
Output paths: $FileNameWithoutExtension$.css
Make sure also to tick 'create output from stdout'

Related

Issues when deploying my serverless project in windows

I have created a serverless boilerplate project using this command
sls create --template aws-nodejs-typescript --path my-project
I configured properly my AWS credantials thus I was able to depoly it successfully without any problem
sls deploy
But when I test de hello function I get the following error (after executing sls logs -f hello)
ERROR Uncaught Exception {"errorType":"Runtime.ImportModuleError","errorMessage":"Error: Cannot
find module 'handler'\nRequire stack:\n-
/var/runtime/UserFunction.js\n-
/var/runtime/index.js","stack":["Runtime.ImportModuleError: Error:
Cannot find module 'handler '","Require stack:","-
/var/runtime/UserFunction.js","- /var/runtime/index.js"," at
_loadUserApp (/var/runtime/UserFunction.js:100:13)"," at Object.module.ex ports.load (/var/runtime/UserFunction.js:140:17)","
at Object. (/var/runtime/index.js:43:30)"," at
Module._compile (internal/modules/cjs/loader.js :999:30)"," at
Object.Module._extensions..js
(internal/modules/cjs/loader.js:1027:10)"," at Module.load
(internal/modules/cjs/loader.js:863:32)"," at Func
tion.Module._load (internal/modules/cjs/loader.js:708:14)"," at
Function.executeUserEntryPoint [as runMain]
(internal/modules/run_main.js:60:12)"," at intern
al/main/run_main_module.js:17:47"]} END RequestId:
28588f41-1c4c-4391-82da-0c89bc1f9707 REPORT RequestId:
28588f41-1c4c-4391-82da-0c89bc1f9707 Duration: 164.91 ms Billed
Duration: 165 ms Memory Size: 1024 MB Max Memory Used: 15 MB
Unknown application error occurred Runtime.ImportModuleError
I think the problem is in the Windows environment, because when I deploy the service with Mac it works with no issue ! Did I need an extra-configuration to use Serverless with windows ? Thanks for any suggestion

Unable to find module error when trying to execute protractor tests

I have created a sample framework and am trying to login to my application
Below is a screenshot of my package structure
This is my LoginObjects.js which is present inside Pages folder
I am accessing this in my Spec\Login.js folder
When I execute my configuration.js I am getting this below error. Please let me know where I am going wrong
Failures:
Testing Login Page encountered a declaration exception
Message:
Error: Cannot find module './Pages/LoginObjects'
Require stack:
- C:\Users\silpa\eclipse-workspace_udemy_js\Nextgen\Specs\Login.js
- C:\Users\silpa\eclipse-workspace_udemy_js\Nextgen\node_modules\jasmine\lib\jasmine.js
- C:\Users\silpa\eclipse-workspace_udemy_js\Nextgen\node_modules\protractor\built\frameworks\jasmine.js
- C:\Users\silpa\eclipse-workspace_udemy_js\Nextgen\node_modules\protractor\built\runner.js
- C:\Users\silpa\eclipse-workspace_udemy_js\Nextgen\node_modules\protractor\built\launcher.js
- C:\Users\silpa\eclipse-workspace_udemy_js\Nextgen\node_modules\protractor\built\cli.js
- C:\Users\silpa\eclipse-workspace_udemy_js\Nextgen\node_modules\protractor\bin\protractor
Stack:
Error: Cannot find module './Pages/LoginObjects'
Require stack:
- C:\Users\silpa\eclipse-workspace_udemy_js\Nextgen\Specs\Login.js
- C:\Users\silpa\eclipse-workspace_udemy_js\Nextgen\node_modules\jasmine\lib\jasmine.js
- C:\Users\silpa\eclipse-workspace_udemy_js\Nextgen\node_modules\protractor\built\frameworks\jasmine.js
- C:\Users\silpa\eclipse-workspace_udemy_js\Nextgen\node_modules\protractor\built\runner.js
- C:\Users\silpa\eclipse-workspace_udemy_js\Nextgen\node_modules\protractor\built\launcher.js
- C:\Users\silpa\eclipse-workspace_udemy_js\Nextgen\node_modules\protractor\built\cli.js
- C:\Users\silpa\eclipse-workspace_udemy_js\Nextgen\node_modules\protractor\bin\protractor
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:880:15)
at Function.Module._load (internal/modules/cjs/loader.js:725:27)
at Module.require (internal/modules/cjs/loader.js:952:19)
at require (internal/modules/cjs/helpers.js:88:18)
at Suite.<anonymous> (C:\Users\silpa\eclipse-workspace_udemy_js\Nextgen\Specs\Login.js:5:15)
at Object.<anonymous> (C:\Users\silpa\eclipse-workspace_udemy_js\Nextgen\Specs\Login.js:2:1)
at Module._compile (internal/modules/cjs/loader.js:1063:30)
1 spec, 1 failure
Finished in 2.136 seconds
you need to get out of the Specs folder first, then get in the Pages one.
Try with '../Pages/LoginObjects'

every command begin with npm has issue

Here is my problem,
I think I made mistake by adding proxy settings in a wrong way,
now every command begin with npm does not work.
here is a pic of the error:
λ npm config set registry "http://registry.npmjs.org/"
Error: Failed parsing JSON config key "proxy: "="'http://xxx.xx.xx.xx:8080'"
at parseField (E:\nodejs\node_modules\npm\lib\config\core.js:376:13)
at E:\nodejs\node_modules\npm\lib\config\core.js:330:24
at Array.forEach (<anonymous>)
at Conf.add (E:\nodejs\node_modules\npm\lib\config\core.js:328:23)
at ConfigChain.addString (E:\nodejs\node_modules\npm\node_modules\config-chain\index.js:244:8)
at Conf.<anonymous> (E:\nodejs\node_modules\npm\lib\config\core.js:316:10)
at E:\nodejs\node_modules\npm\node_modules\graceful-fs\graceful-fs.js:123:16
at FSReqCallback.readFileAfterClose [as oncomplete] (internal/fs/read_file_context.js:63:3)
Error: Failed parsing JSON config key "proxy: "="'http://xxx.xx.xx.xx:8080'"
at parseField (E:\nodejs\node_modules\npm\lib\config\core.js:376:13)
at E:\nodejs\node_modules\npm\lib\config\core.js:330:24
at Array.forEach (<anonymous>)
at Conf.add (E:\nodejs\node_modules\npm\lib\config\core.js:328:23)
at ConfigChain.addString (E:\nodejs\node_modules\npm\node_modules\config-chain\index.js:244:8)
at Conf.<anonymous> (E:\nodejs\node_modules\npm\lib\config\core.js:316:10)
at E:\nodejs\node_modules\npm\node_modules\graceful-fs\graceful-fs.js:123:16
at FSReqCallback.readFileAfterClose [as oncomplete] (internal/fs/read_file_context.js:63:3)
Assuming you set your proxy setting in a similar way to the registry setting you show: Delete the proxy line in your .npmrc file and try again. The .npmrc file can be found in the four places listed in the npm docs. In most cases, you'll find the one with the proxy entry in ~/.npmrc.

React-native/hermes build error. no such file or directory: index.android.bundle.packager.map

Description
Getting the following messages during build with hermesEnabled set to true
('...' represent removed text):
(full error log is here)
android\app\build\generated\assets\react\release\index.android.bundle:13:134: warning: the variable "Promise" was not declared in function "isBoldTextEnabled"
...
android\app\build\generated\assets\react\release\index.android.bundle:27:2907: warning: the variable "DebuggerInternal" was not declared in function "value 14#"
...
android\app\build\generated\assets\react\release\index.android.bundle:92:57773: warning: the variable "setTimeout" was not declared in function "wi"
...
fs.js:114
throw err;
^
Error: ENOENT: no such file or directory, open 'android\app\build\intermediates\sourcemaps\react\release\index.android.bundle.packager.map'
at Object.openSync (fs.js:443:3)
at Object.readFileSync (fs.js:343:35)
at Object.<anonymous> (C:\esites-grocery\test2.hermes\plumpclient\node_modules\react-native\scripts\compose-source-maps.js:33:43)
at Module._compile (internal/modules/cjs/loader.js:778:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)
at Function.Module.runMain (internal/modules/cjs/loader.js:831:12)
at startup (internal/bootstrap/node.js:283:19)
FAILURE: Build failed with an exception.
* Where:
Script 'node_modules\react-native\react.gradle' line: 191
* What went wrong:
Execution failed for task ':app:bundleReleaseJsAndAssets'.
> Process 'command 'cmd'' finished with non-zero exit value 1
(The referenced file exists, at least after the build failed).
Environment
Building on Windows 10
React Native version: 0.62.2
What I tried to do
Tried to bump soLoader to 0.8.0 and to 0.8.2 (although this is not supposed to be needed in RN 0.62.2) as suggested in https://github.com/facebook/react-native/issues/25927#issuecomment-539415154
Modifying the following extra packages definition in build.gradle:
extraPackagerArgs: ["--sourcemap-output", "$buildDir/intermediates/assets/release/index.android.bundle.map"]
to
extraPackagerArgs: ["--sourcemap-output", "$buildDir/intermediates/sourcemaps/react/release/index.android.bundle.packager.map"]
Fixed the error (the warnings are still there).
An APK is created and is running..
./gradlew clean
After doing the ./gradlew clean It worked for me.
OR
For Windows:
gralde clean

Constant error when writing in files in create-react-app based project in WebStorm

I am constantly getting an error from babylon.js (which I'm not sure I'm even using?) in my "Run" terminal in WebStorm.
I get the following error:
cmd.exe /D /C call C:/Users/Jens/IdeaProjects/Vaskemaskine/WashingmachineFrontend/vaskemaskine-app/node_modules/babel-core/node_modules/.bin/babylon.cmd --source-maps --out-file strings-compiled.js --presets es2015 C:\Users\Jens\IdeaProjects\Vaskemaskine\WashingmachineFrontend\vaskemaskine-app\src\strings.js
fs.js:549
return binding.open(pathModule._makeLong(path), stringToFlags(flags), mode);
^
Error: ENOENT: no such file or directory, open 'C:\Users\Jens\IdeaProjects\Vaskemaskine\WashingmachineFrontend\vaskemaskine-app\src\--source-maps'
at Error (native)
at Object.fs.openSync (fs.js:549:18)
at Object.fs.readFileSync (fs.js:397:15)
at Object.<anonymous> (C:\Users\Jens\IdeaProjects\Vaskemaskine\WashingmachineFrontend\vaskemaskine-app\node_modules\babel-core\node_modules\babylon\bin\babylon.js:13:15)
Occasionally I will also get an error in a popup in WebStorm:
Cannot save C:\Users\Jens\IdeaProjects\Vaskemaskine\WashingmachineFrontend\vaskemaskine-app\src\strings.js.
The file left unchanged.
Your changes were written to strings.js___jb_tmp___.
Not sure if that is related or not.
I tried googling around, but no one seems to be having the same problem as me. Anyone has a clue about what is going on? I haven't configured the scripts delivered with create-react-app, other than "ejecting" out.