how to setup node and npm to work properly - node-modules

I try to follow one course at udemy with laravel framework. So we put some files in resources->assets/libs folder for css and js.
There are gulpfile.js and I wrote paths to compile all for better responses. I have issue with latest version of node, so I downgrade version to 6.X. Terminal didn't recognize command gulp so I add in environment variables node_path %AppData%\npm\node_modules after that command is avaliable but everytime I got message when I hit gulp "unexpected token".
laravel version - is 5.2.45
node version -6.17.1
gulp version (cli-2.2.0) and local version (4.0.1)
I have never worked before with this stuff.
I try random solutions like npm rebuild, npm uninstall, npm rebuild -g, and deleted several times node_module in laravel project but without success.
var elixir = require('laravel-elixir');
/*
|--------------------------------------------------------------------------
| Elixir Asset Management
|--------------------------------------------------------------------------
|
| Elixir provides a clean, fluent API for defining some basic Gulp tasks
| for your Laravel application. By default, we are compiling the Sass
| file for our application, as well as publishing vendor resources.
|
*/
elixir(function(mix) {
mix.sass('app.scss')
.styles([
'libs/blog-post.css',
'libs/bootstrap.css',
'libs/bootstrap.min.css',
'libs/font-awsome.css',
'libs/metisMenu.css',
'libs/sb-admin-2.css',
'libs/styles.css'
], './public/css/libs.css')
.scripts([
'libs/bootstrap.js',
'libs/bootstrap.min.js',
'libs/jquery.js',
'libs/metisMenu.js',
'libs/sb-admin-2.js',
'libs/scripts.js'
], './public/js/libs.js')
});

Related

Ionic Run Android error - on Ubuntu 16

I'm running Ubuntu 16.
Here's my System information:
Your system information:
Cordova CLI: 6.3.1
Gulp version: CLI version 1.2.2
Gulp local: Local version 3.9.1
Ionic Framework Version: 1.2.4-nightly-1917
Ionic CLI Version: 2.0.0
Ionic App Lib Version: 2.0.0-beta.20
OS: Distributor ID: Ubuntu Description: Ubuntu 16.04.1 LTS
Node Version: v4.4.7
When I try to do a sudo ionic run android or a sudo ionic build android from my project directory, I get this output:
Running command: /home/simon/flash-trader/hooks/after_prepare/010_add_platform_class.js /home/simon/flash-trader
add to body class: platform-android
Caught exception:
TypeError: Can't call method on undefined
at TypeError (native)
at module.exports (/home/simon/flash-trader/node_modules/karma/node_modules/core-js/modules/_defined.js:3:28)
at createHTML (/home/simon/flash-trader/node_modules/karma/node_modules/core-js/modules/_string-html.js:7:19)
at bold (/home/simon/flash-trader/node_modules/karma/node_modules/core-js/modules/es6.string.bold.js:5:12)
at cb (/usr/lib/node_modules/ionic/node_modules/ionic-app-lib/node_modules/winston/lib/winston/logger.js:206:7)
at done (/usr/lib/node_modules/ionic/node_modules/ionic-app-lib/node_modules/winston/node_modules/async/lib/async.js:167:19)
at /usr/lib/node_modules/ionic/node_modules/ionic-app-lib/node_modules/winston/node_modules/async/lib/async.js:40:16
at /usr/lib/node_modules/ionic/node_modules/ionic-app-lib/node_modules/winston/lib/winston/logger.js:193:9
at Console.log (/usr/lib/node_modules/ionic/node_modules/ionic-app-lib/node_modules/winston/lib/winston/transports/console.js:127:3)
at emit (/usr/lib/node_modules/ionic/node_modules/ionic-app-lib/node_modules/winston/lib/winston/logger.js:186:17)
at /usr/lib/node_modules/ionic/node_modules/ionic-app-lib/node_modules/winston/node_modules/async/lib/async.js:157:13
at _each (/usr/lib/node_modules/ionic/node_modules/ionic-app-lib/node_modules/winston/node_modules/async/lib/async.js:57:9)
at Object.async.each (/usr/lib/node_modules/ionic/node_modules/ionic-app-lib/node_modules/winston/node_modules/async/lib/async.js:156:9)
at Logger.log (/usr/lib/node_modules/ionic/node_modules/ionic-app-lib/node_modules/winston/lib/winston/logger.js:214:9)
at target.(anonymous function) [as error] (/usr/lib/node_modules/ionic/node_modules/ionic-app-lib/node_modules/winston/lib/winston/common.js:54:18)
at Socket.<anonymous> (/usr/lib/node_modules/ionic/lib/utils/cordova.js:83:11)
Mind letting us know? https://github.com/driftyco/ionic-cli/issues
Caught exception:
TypeError: Can't call method on undefined
at TypeError (native)
at module.exports (/home/simon/flash-trader/node_modules/karma/node_modules/core-js/modules/_defined.js:3:28)
at createHTML (/home/simon/flash-trader/node_modules/karma/node_modules/core-js/modules/_string-html.js:7:19)
at bold (/home/simon/flash-trader/node_modules/karma/node_modules/core-js/modules/es6.string.bold.js:5:12)
at cb (/usr/lib/node_modules/ionic/node_modules/ionic-app-lib/node_modules/winston/lib/winston/logger.js:206:7)
at done (/usr/lib/node_modules/ionic/node_modules/ionic-app-lib/node_modules/winston/node_modules/async/lib/async.js:167:19)
at /usr/lib/node_modules/ionic/node_modules/ionic-app-lib/node_modules/winston/node_modules/async/lib/async.js:40:16
at /usr/lib/node_modules/ionic/node_modules/ionic-app-lib/node_modules/winston/lib/winston/logger.js:193:9
at Console.log (/usr/lib/node_modules/ionic/node_modules/ionic-app-lib/node_modules/winston/lib/winston/transports/console.js:127:3)
at emit (/usr/lib/node_modules/ionic/node_modules/ionic-app-lib/node_modules/winston/lib/winston/logger.js:186:17)
at /usr/lib/node_modules/ionic/node_modules/ionic-app-lib/node_modules/winston/node_modules/async/lib/async.js:157:13
at _each (/usr/lib/node_modules/ionic/node_modules/ionic-app-lib/node_modules/winston/node_modules/async/lib/async.js:57:9)
at Object.async.each (/usr/lib/node_modules/ionic/node_modules/ionic-app-lib/node_modules/winston/node_modules/async/lib/async.js:156:9)
at Logger.log (/usr/lib/node_modules/ionic/node_modules/ionic-app-lib/node_modules/winston/lib/winston/logger.js:214:9)
at target.(anonymous function) [as error] (/usr/lib/node_modules/ionic/node_modules/ionic-app-lib/node_modules/winston/lib/winston/common.js:54:18)
at Socket.<anonymous> (/usr/lib/node_modules/ionic/lib/utils/cordova.js:83:11)
Yes, the exact same error twice. I've set up my phone on Ubuntu as specified on developer.android.com. Debug mode is enabled. All my environment variables are set (I believe.) I installed the Android SDK through Android Studio.
This error is pretty clandestine. Has anyone seen it before?
However, ionic serve builds and runs the project perfectly.
A Google search turns up a few related questions but nothing that seems to match my exact situation. Thanks for the help.
In the end, what i did was a confluence of things.
I had to do a chown -R $USER ~/[project name] so that we don't have to **sudo** ionic. Sudo uses different environment variables to the rest of the shell apparently, and so ANDROID_HOME, etc., wasn't accessible.
I also had to change my JAVA_HOME because it was set like [jdk-path]/bin, and should just be [jdk-path]/
It might also have made a difference that I uninstalled the version of the app that I had downloaded from the Google Play Store (as the app I'm trying to build is already published).
I also changed a line in cordova.js that said something like log("foo").green.bold to just log(foo).green in the liveReload function.
Good luck if you get the same problem.

Install Latest Version of Firefox on Travis And Run with Protractor

Travis installs Firefox 31.0esr by default, but we want to always use the latest version. The reference here says it should be pretty straight forward, but it doesn't seem to actually install, rather it just seems to download the tar file. Protractor still uses Firefox version 31.0esr when it runs.
travis.yml
addons:
firefox: "latest"
protractor.conf.js
capabilities: {
'browserName': 'firefox'
}
Logs:
Initial Firefox install still happens:
[34m[1mInstalled Firefox version[0m
firefox 31.0esr
... the addon section kicks in and downloads the file fine, before the before_install section as expected:
[0Ktravis_fold:start:install_firefox
[0K$ export FIREFOX_SOURCE_URL='https://download.mozilla.org/?product=firefox-latest&lang=en-US&os=linux64'
[33;1mInstalling Firefox latest[0m
travis_time:start:0dff0345
[0K$ wget -O /tmp/firefox-latest.tar.bz2 $FIREFOX_SOURCE_URL
--2016-01-04 23:29:18-- https://download.mozilla.org/?product=firefox-latest&lang=en-US&os=linux64
Resolving download.mozilla.org (download.mozilla.org)... 52.20.26.65
Connecting to download.mozilla.org (download.mozilla.org)|52.20.26.65|:443... connected.
HTTP request sent, awaiting response... 302 Found
Location: http://download.cdn.mozilla.net/pub/firefox/releases/43.0.3/linux-x86_64/en-US/firefox-43.0.3.tar.bz2 [following]
--2016-01-04 23:29:18-- http://download.cdn.mozilla.net/pub/firefox/releases/43.0.3/linux-x86_64/en-US/firefox-43.0.3.tar.bz2
Resolving download.cdn.mozilla.net (download.cdn.mozilla.net)... 23.0.160.35, 23.0.160.65
Connecting to download.cdn.mozilla.net (download.cdn.mozilla.net)|23.0.160.35|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 52525181 (50M) [application/x-bzip2]
Saving to: `/tmp/firefox-latest.tar.bz2'
0% [ ] 0 --.-K/s
33% [============> ] 17,618,150 84.0M/s
67% [=========================> ] 35,556,926 84.7M/s
100%[======================================>] 52,525,181 83.6M/s in 0.6s
2016-01-04 23:29:18 (83.6 MB/s) - `/tmp/firefox-latest.tar.bz2' saved [52525181/52525181]
travis_time:end:0dff0345:start=1451950158289192377,finish=1451950158979104185,duration=689911808
[0Ktravis_fold:end:install_firefox
... then when protractor starts:
[launcher] Running 1 instances of WebDriver
Selenium standalone server started at http://172.17.1.120:39697/wd/hub
Browser details:
Platform: LINUX
Browser Name: firefox
Browser Version: 31.0
I have a sneaking suspicion that even though the Travis docs says the addon section installs the file too, there is no indication this actually happens so I don't think it does.
For interests sake, this is how we print out the system information when protractor starts:
this.getBrowserCapabilities = function() {
return browser.getCapabilities().then(function (s) {
var browserCapabilities = {
browserName: '',
browserVersion: '',
platform: ''
};
browserCapabilities.platform = s.caps_.platform;
browserCapabilities.browserName = s.caps_.browserName;
browserCapabilities.browserVersion = s.caps_.version;
return browserCapabilities;
});
};
I stumbled over the same issue myself and I can confirm that Travis only downloads the specified firefox version.
This is what I did in my build script to use the downloaded version (in my example 43.0).
First, configure the addon in your .travis.yml file:
addons:
firefox: "43.0"
Now before runing your tests execute these steps:
echo "Extracting firefox and setting PATH variable..."
tar -xjf /tmp/firefox-43.0.tar.bz2 --directory /tmp
export PATH="/tmp/firefox:$PATH"
echo "Using firefox version `firefox --version`"
For a working example see also:
https://github.com/astehlik/typo3-extension-news_richteaser/blob/master/.travis.yml
I'm using Selenium in my case but I guess it should work no different with protractor.

Polymer starter kit unit testing

I'm trying out polymer-starter-kit for the first time. Using yeoman generator I have scaffolded the basic project. When I run the unit test using Web Component Tester, am getting the following error.
Error: Could not request headers from http://selenium-release.storage.googleapis.com/2.47/IEDriverServer_x64_2.46.0.zip
Following is the stdout when I run gulp test:local
[12:39:44] Using gulpfile
~\tryout\js\polymer\admin-portal-client\gulpfile.js [12:39:44]
Starting 'wct:local'... Starting Selenium server for local browsers
---------- selenium-standalone installation starting
--- selenium install: from: http://selenium-release.storage.googleapis.com/2.47/selenium-server-standalone-2.47.1.jar
to:
C:\Users\ninpv1\tryout\js\polymer\admin-portal-client\node_modules\web-component-tester\node_modules\wct-local\node_modules\selenium-standalone.selenium\se
lenium-server\2.47.1-server.jar
--- chrome install: from: http://chromedriver.storage.googleapis.com/2.16/chromedriver_win32.zip
to:
C:\Users\ninpv1\tryout\js\polymer\admin-portal-client\node_modules\web-component-tester\node_modules\wct-local\node_modules\selenium-standalone.selenium\ch
romedriver\2.16-x64-chromedriver
--- ie install: from: http://selenium-release.storage.googleapis.com/2.47/IEDriverServer_x64_2.46.0.zip
to:
C:\Users\ninpv1\tryout\js\polymer\admin-portal-client\node_modules\web-component-tester\node_modules\wct-local\node_modules\selenium-standalone.selenium\ie
driver\2.46.0-x64-IEDriverServer.exe
--- File from http://chromedriver.storage.googleapis.com/2.16/chromedriver_win32.zip
has already been downloaded
--- File from http://selenium-release.storage.googleapis.com/2.47/selenium-server-standalone-2.47.1.jar
has already been downloaded [12:40:10]
'wct:local' errored after 26 s
[12:40:10] Error: Could not request headers from
http://selenium-release.storage.googleapis.com/2.47/IEDriverServer_x64_2.46.0.zip:
Node version : v0.12.7
npm version : 2.11.3
OS : Windows 7
What could be wrong ?
Because this file http://selenium-release.storage.googleapis.com/2.47/IEDriverServer_x64_2.46.0.zip doesn't exist on that link. Just try to browse it on your browser on all 3 files. You will find this is the only one that doesn't exist. However, http://selenium-release.storage.googleapis.com/2.47/IEDriverServer_x64_2.47.0.zip does exist.
Update: Looks like someone already opened an issue.
https://github.com/Polymer/web-component-tester/issues/206

how can i run bundle install elsewhere?

$ git push heroku master
Counting objects: 70, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (61/61), done.
Writing objects: 100% (70/70), 16.06 KiB | 0 bytes/s, done.
Total 70 (delta 2), reused 0 (delta 0)
-----> Ruby app detected
-----> Compiling Ruby/Rails
-----> Using Ruby version: ruby-2.0.0
-----> Installing dependencies using Bundler version 1.3.2
New app detected loading default bundler cache
Running: bundle install --without development:test --path vendor/bundle --binstubs vendor/bundle/bin --deployment
You are trying to install in deployment mode after changing
your Gemfile. Run `bundle install` elsewhere and add the
updated Gemfile.lock to version control.
You have added to the Gemfile:
* pg
* rails_12factor
Bundler Output: You are trying to install in deployment mode after changing
your Gemfile. Run `bundle install` elsewhere and add the
updated Gemfile.lock to version control.
You have added to the Gemfile:
* pg
* rails_12factor
!
! Failed to install gems via Bundler.
!
! Push rejected, failed to compile Ruby app
To git#heroku.com:obscure-reaches-5507.git
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'git#heroku.com:obscure-reaches-5507.git'
how can i solve this problem?
This problem is bacause you commit bad Gemfile.lock (pg and rails_12factor gems) to heroku server. You need to update Gemfile.lock on heroku.
Do following steps:
save HEROKU_APP_NAME of existing heroku app ( HEROKU_APP_NAME.herokuapp.com )
remove heroku application from https://dashboard.heroku.com/apps and create new one
rename new heroku app to old HEROKU_APP_NAME
remove Gemfile.lock from your git repo
remove Gemfile.lock form your local project and form .gitignore (if it exist there)
run bundle install
commit changes to git repo ( new created Gemfile.lock )
run git push heroku master
In your gem file you can add all the required gems along with rails_12factor and try
gem 'rails_12factor', group: :production
gem 'rails_serve_static_assets','~> 0.0.4', group: :production
gem 'rails_stdout_logging','~> 0.0.3',group: :production

Cannot find ramaze that is installed with gems

I have Ramaze version 2012.04.14, Rubygems 1.3.6 and Ruby 1.8.6 so I have the latest version. My console recognises Ramaze and all associated commands. (I can run ramaze --version)
I have made a folder inside my www/ folder inside my localhost environment where public files go.
www/demo/hello_ramaze.rb with the code as explained in the tutorial as the file.
require 'ramaze'
class MyController < Ramaze::Controller
map '/'
def index
return "Hello, Ramaze!"
end
end
Ramaze.start
I try to execute ruby hello_ramaze.rb and I get this error.
hello_ramaze.rb:1:in `require': no such file to load -- ramaze
(LoadError)
from hello_ramaze.rb:1
I upgraded to Ruby 1.9.3 and the problem is solved.
If you use Windows, use Rubyinstaller.

Resources