'500' error with sails.js 'testProject' - javascript

Went to http://sailsjs.org/#!getStarted and went through the steps the page requires. In my Win7 environment, I have node running and tested. I installed sails.js, changed directories, and 'sails lift'. Sails.js succeeds in launching and the CLI looks like:
$ sails lift
info:
info:
info: Sails.js <|
info: v0.9.7 |\
info: /|.\
info: / || \
info: ,' |' \
info: .-'.-==|/_--'
info: `--'-------'
info: __---___--___---___--___---___--___
info: ____---___--___---___--___---___--___-__
info:
info: Server lifted in `c:\Users\Dad\My Documents\Aptana Studio 3 Workspace\First Sails Project\t
estProject`
info: To see your app, visit http://localhost:1337
info: To shut down Sails, press <CTRL> + C at any time.
debug: --------------------------------------------------------
debug: :: Wed Nov 06 2013 14:06:25 GMT-0500 (Eastern Standard Time)
debug:
debug: Environment : development
debug: Port : 1337
debug: --------------------------------------------------------
But when I visit the port I get this on the page:
{
"status": 500,
"errors": [
"Failed to lookup view \"home/index\""
]
}
There is a very long trace at the CLI that begins:
error: Error rendering view at :: c:\Users\Dad\My Documents\Aptana Studio 3 Workspace\First Sails
Project\testProject/views/home/index
error: Using layout located at :: c:\Users\Dad\My Documents\Aptana Studio 3 Workspace\First Sails
Project\testProject/views/layout
error: Server Error (500)
error: Error: Failed to lookup view "home/index"
at Function.app.render (c:\Users\Dad\AppData\Roaming\npm\node_modules\sails\node_modules\expr
ess\lib\application.js:495:17)
.
.
.
The global install of sails.js went fine. All files are present in the views directory. I'm running node v0.8.18 and other apps I have run/render fine. Looking at the '500.js' file in the 'config' directory, if the 'view doesn't exist, just send json' (which is what seems to be happening). But the view does appear to exist so ... what am I missing?

this is a known issue on windows. check the work around in the linked issue or use sails 0.9.4 till the next release.

Related

You're not authorized to run analysis. Please contact the project administrator Sonarqube local

I have very basic setup of sonarqube. It is in initial phase only and it's kind of strange that I'm not able to access sonarqube report at localhost:9090 (default is of course 9000 but I just changed it to 9090). I'm able to login to sonarqube at localhost:9090
When I run node sonarqube-scanner.js command, it gets executed successfully as shown below but it gives authorization error,
INFO: Analysis report generated in 225ms, dir size=144.8 kB INFO:
Analysis report compressed in 338ms, zip size=49.6 kB INFO:
INFO: EXECUTION FAILURE INFO:
INFO: Total time: 6:16.209s INFO: Final Memory: 16M/60M INFO:
ERROR: Error during SonarScanner execution ERROR: You're not
authorized to run analysis. Please contact the project administrator.
My sonarqube-scanner.js file is as below, as you can I tried with everything eg login, password, token
const scanner = require('sonarqube-scanner');
scanner(
{
serverUrl: "http://localhost:9090",
login: "XXX",
password: "XXX",
token: "sqa_bXXXXXXXXXXXXXXXXX",
options: {
"sonar.sources": "./src"
},
},
() => process.exit()
);
And I use sonarqube docker image as below
docker-compose.yml
version: "3"
services:
sonarqube:
image: sonarqube:community
depends_on:
- db
environment:
SONAR_JDBC_URL: jdbc:postgresql://db:5432/sonar
SONAR_JDBC_USERNAME: sonar
SONAR_JDBC_PASSWORD: sonar
volumes:
- sonarqube_data:/opt/sonarqube/data
- sonarqube_extensions:/opt/sonarqube/extensions
- sonarqube_logs:/opt/sonarqube/logs
ports:
- "9090:9000"
db:
image: postgres:12
environment:
POSTGRES_USER: sonar
POSTGRES_PASSWORD: sonar
volumes:
- postgresql:/var/lib/postgresql
- postgresql_data:/var/lib/postgresql/data
volumes:
sonarqube_data:
sonarqube_extensions:
sonarqube_logs:
postgresql:
postgresql_data:
NOTE : At localhost:9090->Administration->Security-> all checkboxes are checked for all users. Still it is not working.
I literally don't know if anything has changed but I observed one thing as below,
Earlier few days ago,
I was able to generate the report directly to localhost:9090 but all of sudden from today it started indicating You're not authorized to run analysis. Please contact the project administrator.
The Problem
Earlier it used to generate the report on-the-fly directly and create the project on its own. What I mean by that is even when your server is not configured with any project (consider it is completely blank) and if you are running the sonar analysis for the first time, it used to create the project on-the-fly on the sonarqube-server (localhost).
This not not the case anymore (at least in my case)
in my case, my sonarqube-server was completely empty (without any project) and when I was trying to run the sonar analysis again for the first time, it started throwing the error that you are not authorized.
Solution
I just had to create the project manually in sonarqube-server. Then when I ran the analysis, it ran successfully without any problem.
I hope this answer will help someone in future.
It was working for me with 9.4, but not anymore with 9.5.
Did you upgrade recently to 9.5 version?
Perhaps linked to: https://jira-legacy-sonarsource.valiantys.net/browse/SONAR-16260.

Unable to load class error with sonarqube in gitlab

I've been having troubles with getting gitlab to send jobs to sonarqube. I have installed the sonarqube plugin and added my gitlab user token to the sonarqube server. In my gitlab-ci.yml I run the following command:
- git config --global user.email "$GITLAB_USER_EMAIL"
- git config --global user.name "$GITLAB_USER_NAME"
- cd /opt
- wget -q https://sonarsource.bintray.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-3.2.0.1227-linux.zip
- unzip -qq sonar-scanner-cli-3.2.0.1227-linux.zip
- cd /builds/my_user_name/my_project/backend
- /opt/sonar-scanner-3.2.0.1227-linux/bin/sonar-scanner -X -Dsonar.host.url=http://34.230.xx.xx -Dsonar.projectKey=$CI_PROJECT_NAME.develop -Dsonar.projectVersion=$CI_COMMIT_SHA -Dsonar.gitlab.url=https://www.gitlab.com -Dsonar.gitlab.project_id=$CI_PROJECT_ID -Dsonar.gitlab.user_token=$SONAR_PLUGIN_TOKEN -Dsonar.gitlab.commit_sha=$CI_COMMIT_SHA -Dsonar.gitlab.ref_name=$CI_COMMIT_REF_NAME -Dsonar.analysis.mode=preview -Dsonar.sources=.
The error I get is the following. I get this error both with using the npm sonarqube-scanner as well. Does anyone know what is going on?
05:12:15.795 DEBUG: * GitLab 3.0.0 (gitlab)
05:12:16.171 INFO: Process project properties
05:12:16.184 DEBUG: Process project properties (done) | time=13ms
05:12:16.199 INFO: Load project repositories
05:12:16.227 DEBUG: GET 404 http://34.230.xx.xx/batch/project.protobuf?key=my_key_here&issues_mode=true | time=25ms
05:12:16.229 DEBUG: Project repository not available - continuing without it
05:12:16.234 WARN: Project doesn't exist on the server. All issues will be marked as 'new'.
05:12:16.235 INFO: Load project repositories (done) | time=36ms
05:12:16.314 INFO: Scanning only changed files
05:12:16.317 INFO: Execute project builders
05:12:16.999 INFO: ------------------------------------------------------------------------
05:12:17.006 INFO: EXECUTION FAILURE
05:12:17.007 INFO: ------------------------------------------------------------------------
05:12:17.008 INFO: Total time: 4.682s
05:12:17.050 INFO: Final Memory: 11M/104M
05:12:17.051 INFO: ------------------------------------------------------------------------
05:12:17.052 ERROR: Error during SonarQube Scanner execution
java.lang.IllegalStateException: Unable to load component class org.sonar.scanner.scan.ProjectLock
at org.sonar.core.platform.ComponentContainer$ExtendedDefaultPicoContainer.getComponent(ComponentContainer.java:64)
at org.picocontainer.DefaultPicoContainer.getComponent(DefaultPicoContainer.java:678)
at org.sonar.core.platform.ComponentContainer.getComponentByType(ComponentContainer.java:265)
at org.sonar.scanner.scan.ProjectScanContainer.doBeforeStart(ProjectScanContainer.java:120)
at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:133)
at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:121)
at org.sonar.scanner.task.ScanTask.execute(ScanTask.java:48)
at org.sonar.scanner.task.TaskContainer.doAfterStart(TaskContainer.java:84)
at org.sonar.core.platform.ComponentContainer.startComponents(ComponentContainer.java:135)
at org.sonar.core.platform.ComponentContainer.execute(ComponentContainer.java:121)
at org.sonar.scanner.bootstrap.GlobalContainer.executeTask(GlobalContainer.java:121)
at org.sonar.batch.bootstrapper.Batch.doExecuteTask(Batch.java:116)
at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:71)
at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:46)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.sonarsource.scanner.api.internal.IsolatedLauncherProxy.invoke(IsolatedLauncherProxy.java:60)
at com.sun.proxy.$Proxy0.execute(Unknown Source)
at org.sonarsource.scanner.api.EmbeddedScanner.doExecute(EmbeddedScanner.java:171)
at org.sonarsource.scanner.api.EmbeddedScanner.execute(EmbeddedScanner.java:128)
at org.sonarsource.scanner.cli.Main.execute(Main.java:111)
at org.sonarsource.scanner.cli.Main.execute(Main.java:75)
at org.sonarsource.scanner.cli.Main.main(Main.java:61)
Caused by: java.lang.IllegalStateException: Unable to load component class org.sonar.scanner.scan.DefaultInputModuleHierarchy
at org.sonar.core.platform.ComponentContainer$ExtendedDefaultPicoContainer.getComponent(ComponentContainer.java:64)
at org.picocontainer.DefaultPicoContainer.getComponent(DefaultPicoContainer.java:632)
at org.picocontainer.parameters.BasicComponentParameter$1.resolveInstance(BasicComponentParameter.java:118)
at org.picocontainer.parameters.ComponentParameter$1.resolveInstance(ComponentParameter.java:136)
at org.picocontainer.injectors.SingleMemberInjector.getParameter(SingleMemberInjector.java:78)
at org.picocontainer.injectors.ConstructorInjector$CtorAndAdapters.getParameterArguments(ConstructorInjector.java:309)
at org.picocontainer.injectors.ConstructorInjector$1.run(ConstructorInjector.java:335)
at org.picocontainer.injectors.AbstractInjector$ThreadLocalCyclicDependencyGuard.observe(AbstractInjector.java:270)
at org.picocontainer.injectors.ConstructorInjector.getComponentInstance(ConstructorInjector.java:364)
at org.picocontainer.injectors.AbstractInjectionFactory$LifecycleAdapter.getComponentInstance(AbstractInjectionFactory.java:56)
at org.picocontainer.behaviors.AbstractBehavior.getComponentInstance(AbstractBehavior.java:64)
at org.picocontainer.behaviors.Stored.getComponentInstance(Stored.java:91)
at org.picocontainer.DefaultPicoContainer.getInstance(DefaultPicoContainer.java:699)
at org.picocontainer.DefaultPicoContainer.getComponent(DefaultPicoContainer.java:647)
.....
Check your Sonar plugins versions, compared to your SonarQube version.
As in this thread, you would (for instance) be running SonarQube 7.1 with extensions made for SonarQube 7.0 (Branch, Developer).
The OP Coherent reports in the comments using:
docker run -d --name sonarqube -p 80:9000 -p 9092:9092 \
-e SONARQUBE_JDBC_USERNAME=x
-e SONARQUBE_JDBC_PASSWORD=y
-e SONARQUBE_JDBC_URL=jdbc:postgresql://mydatabase-east-1.rds.amazonaws.com/sonar sonarqube:7.0
Tibor Blenessy adds
Try to remove -Dsonar.analysis.mode=preview, this option is no longer supported.

Error when launching server.js on Ethereum Hello World app

I followed this tutorial with the web3 1.0 source code.
The tutorial suggested to use web3 0.20.x but web3 0.20.x could not be installed in my computer(Ubuntu 16.04.3).
https://medium.com/#mvmurthy/full-stack-hello-world-voting-ethereum-dapp-tutorial-part-1-40d2d0d807c2
https://github.com/mjhm/hello_world_dapp
I installed and downloaded necessary files and ganache-cli is launched successfully.
Listening on localhost:8545
eth_accounts
eth_gasPrice
eth_sendTransaction
Transaction: 0xffcd7597522313760d262b251037024002054f66fa354892fe65955510f0049c
Contract created: 0x91885fa1a0644951b43ddb57d8d50c441fee26c6
Gas usage: 354524
Block Number: 1
Block Time: Tue Dec 26 2017 06:23:23 GMT+0000 (UTC)
eth_getTransactionReceipt
eth_getCode
Now I want to launch http_server with npm run http_server command but I got error:
> hello_world_voting#1.0.0 http_server /home/g-iot-info/hello_world_voting
> ./server.js
Unhandled rejection Error: Provider not set or invalid
How do I solve this problem?
I don't know where I should look at first.
Thanks in advance.

How to run openshift MEAN project in localhost or development system Ubuntu?

I have created a MEAN stack application on https://openshift.redhat.com/ and it was successfully running on the web.
Default source code of the project synced form: https://github.com/linnovate/mean-on-openshift.git
For further development I am cloning the hosted git source using using git url mentioned in the applications page. (e.g git clone ssh://55e86e9f89f5cf1d29000001#nodejs-tapslab.rhcloud.com/~/git/nodejs.git/).
After clone the source code to local system, opening the project in sublime text editor. I can see in the config/env/development.js there are lot of configuration are used like process.env.OPENSHIFT_XXX. I was changed the some config value mentioned below and trying to start server using command : 'node server', but server was not starting throwing error.
{
db: db: 'mongodb://' + (process.env.DB_PORT_27017_TCP_ADDR || 'localhost:27017') + ':' + '/mean-dev',
hostname: process.env.OPENSHIFT_NODEJS_IP || 'http://localhost:3000'
}
Can someone help me how to run Openshift mean project in local system and what all configuration needed before running it in local system.
System Config :
Ubuntu 12.04
MongoDB v2.6.6
Nodejs v0.10.40
npm 1.4.28
grunt-cli v0.1.13
Error :
$ node server
Mean app started on port 3000 (development)
events.js:72
throw er; // Unhandled 'error' event
^
Error: getaddrinfo ENOTFOUND
at errnoException (dns.js:37:11)
at Object.onanswer [as oncomplete] (dns.js:124:16)
Git:
$ NODE_ENV=test node server

Node.js - "Uncaught Error: Cannot find module "redis""

I'm trying to build a simple "Twitter" style short messaging app in Node.js which uses Redis as the database (although I've heard that MongoDB might be easier)...
I have found a few links that point me in the direction of https://github.com/mranney/node_redis so I set up a new Node.js project using Brunch and ran the following in my project directory as instructed:
npm install redis hiredis
I then added the following from the auth.js example to vendor/script.js
var redis = require("redis"),
client = redis.createClient();
However when I run brunch w -s I get the following error in the console:
Uncaught Error: Cannot find module "redis"
I'm assuming that it's something to do with modules not being included into my project but I'm not really sure where to start. I added
"redis": "latest"
to my package.json file but that doesn't appear to do anything.
I also tried to install the redis module globally by running
sudo npm install -g redis
But still no luck.
I should also add that I have redis-server installed on OS X, and I can run it in the terminal:
$ redis-server
[2221] 17 Aug 10:48:42 # Warning: no config file specified, using the default config. In order to specify a config file use 'redis-server /path/to/redis.conf'
[2221] 17 Aug 10:48:42 * Server started, Redis version 2.4.13
[2221] 17 Aug 10:48:42 * The server is now ready to accept connections on port 6379
[2221] 17 Aug 10:48:42 - 0 clients connected (0 slaves), 922304 bytes in use
[2221] 17 Aug 10:48:47 - 0 clients connected (0 slaves), 922304 bytes in use
My application directory is a standard brunch install -
app
config.coffee
generators
node_modules
package.json
public
README.md
test
vendor
What am I doing wrong?
Brunch is html5 application assembler, not node.js, you can’t require node modules there.

Categories

Resources