Install after formatted

Hi all,
I have a proble, I formatted my hard disk and reinstall Linux Mint on this, now I don’t remember how I install everything to work on ionic and I become to read some tutorials…

I downloaded the node.js from official website, I downloaded where is written "Install"
After I type on my terminal:

sudo npm install -g cordova ionic

It’s works for a few minutes and after I type on terminal:

ionic start myapp tabs

and the terminal said:

/usr/bin/env: node: File or directory doesn't exists

What can I do?
Help please!!!
Thanks

i assume you need to create a symlink to node

which node
ln -S /usr/bin/node path (take the path from output)

What is the path from output?
You mean /usr/bin/env ?

I do it but didn’t work
I take a screenshot…
image

do you have node installed?

do

ls -la /usr/local/bin/node

Yes or better i Download it from node web site And after I typed on command Line npm install -g Cordova ionic

we need to figure out where your node is installed to.

give me the output for

ls -la /usr/local/bin/node

then we can symlink the location correctly

I type

sudo ls -la /usr/local/bin/node

the output is:

ls: impossible access to /usr/local/bin/node: file or directory doesn't exists

So however I delete (uninstall) cordova and ionic because it isn’t work I don’t know about the problem…
When I installed ionic and cordova I had not a lot of problem.
If you want you can connect in remote with teamviewer because I’m not a master with linux and I don’t know very well the commands…

seems you didnt install node correct. reinstall node with brew.

brew install nodejs (or node)

then do the steps i told you.

I just install nodejs now with a tutorial and now if I type

nodejs -v #v0.10.37
npm -v #2.7.5

I just do:

sudo apt-get remove nodejs nodejs-dev npm
sudo sudo add-apt-repository ppa:chris-lea/node.js
sudo apt-get update
sudo apt-get install nodejs npm

but the last one didn’t work and so I did

sudo apt-get install nodejs

and finally when I type nodejs -v and npm -v its said the current versions
BUT now, i tried to doing

npm install -g cordova ionic

and the terminal answered it:

npm WARN locking Error: EACCES, open '/home/francesco/.npm/_locks/cordova-748ccae172373beb.lock’
npm WARN locking /home/francesco/.npm/_locks/cordova-748ccae172373beb.lock failed { [Error: EACCES, open ‘/home/francesco/.npm/_locks/cordova-748ccae172373beb.lock’]
npm WARN locking errno: 3,
npm WARN locking code: ‘EACCES’,
npm WARN locking path: ‘/home/francesco/.npm/_locks/cordova-748ccae172373beb.lock’ }
npm ERR! Linux 3.13.0-37-generic
npm ERR! argv “node” “/usr/local/bin/npm” “install” “-g” “cordova” "ionic"
npm ERR! node v0.10.37
npm ERR! npm v2.7.5

npm ERR! Attempt to unlock /usr/lib/node_modules/cordova, which hasn’t been locked
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR! https://github.com/npm/npm/issues
npm WARN locking Error: EACCES, open '/home/francesco/.npm/_locks/ionic-870c91ec4eeb12ef.lock’
npm WARN locking /home/francesco/.npm/_locks/ionic-870c91ec4eeb12ef.lock failed { [Error: EACCES, open ‘/home/francesco/.npm/_locks/ionic-870c91ec4eeb12ef.lock’]
npm WARN locking errno: 3,
npm WARN locking code: ‘EACCES’,
npm WARN locking path: ‘/home/francesco/.npm/_locks/ionic-870c91ec4eeb12ef.lock’ }
npm ERR! Linux 3.13.0-37-generic
npm ERR! argv “node” “/usr/local/bin/npm” “install” “-g” “cordova” "ionic"
npm ERR! node v0.10.37
npm ERR! npm v2.7.5

npm ERR! Attempt to unlock /usr/lib/node_modules/ionic, which hasn’t been locked
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR! https://github.com/npm/npm/issues

npm ERR! Please include the following file with any support request:
npm ERR! /home/francesco/npm-debug.log

now you have a different problem. you have access problems for npm.

try this
http://stackoverflow.com/questions/12231846/npm-will-not-install-express

ook…
I do this

sudo chow -R francesco ~/.npm
sudo rmdir ~/tmp #the cli answered me that is impossible because the dir isn't empty
npm install 
npm cache clear
sudo npm install -g express

francesco@francesco-K53BY ~ $ sudo npm install -g express
express@4.12.3 /usr/lib/node_modules/express
├── merge-descriptors@1.0.0
├── cookie-signature@1.0.6
├── utils-merge@1.0.0
├── methods@1.1.1
├── fresh@0.2.4
├── cookie@0.1.2
├── escape-html@1.0.1
├── range-parser@1.0.2
├── content-type@1.0.1
├── finalhandler@0.3.4
├── vary@1.0.0
├── parseurl@1.3.0
├── serve-static@1.9.2
├── content-disposition@0.5.0
├── path-to-regexp@0.1.3
├── depd@1.0.0
├── qs@2.4.1
├── on-finished@2.2.0 (ee-first@1.1.0)
├── debug@2.1.3 (ms@0.7.0)
├── etag@1.5.1 (crc@3.2.1)
├── send@0.12.2 (destroy@1.0.3, ms@0.7.0, mime@1.3.4)
├── proxy-addr@1.0.7 (forwarded@0.1.0, ipaddr.js@0.1.9)
├── type-is@1.6.1 (media-typer@0.3.0, mime-types@2.0.10)
└── accepts@1.2.5 (negotiator@0.5.1, mime-types@2.0.10)

and Finally I do

francesco@francesco-K53BY ~ $ npm install -g cordova ionic
npm WARN locking Error: EACCES, open '/home/francesco/.npm/_locks/cordova-748ccae172373beb.lock’
npm WARN locking /home/francesco/.npm/_locks/cordova-748ccae172373beb.lock failed { [Error: EACCES, open ‘/home/francesco/.npm/_locks/cordova-748ccae172373beb.lock’]
npm WARN locking errno: 3,
npm WARN locking code: ‘EACCES’,
npm WARN locking path: ‘/home/francesco/.npm/_locks/cordova-748ccae172373beb.lock’ }
npm ERR! Linux 3.13.0-37-generic
npm ERR! argv “node” “/usr/local/bin/npm” “install” “-g” “cordova” "ionic"
npm ERR! node v0.10.37
npm ERR! npm v2.7.5

npm ERR! Attempt to unlock /usr/lib/node_modules/cordova, which hasn’t been locked
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR! https://github.com/npm/npm/issues
npm WARN locking Error: EACCES, open '/home/francesco/.npm/_locks/ionic-870c91ec4eeb12ef.lock’
npm WARN locking /home/francesco/.npm/_locks/ionic-870c91ec4eeb12ef.lock failed { [Error: EACCES, open ‘/home/francesco/.npm/_locks/ionic-870c91ec4eeb12ef.lock’]
npm WARN locking errno: 3,
npm WARN locking code: ‘EACCES’,
npm WARN locking path: ‘/home/francesco/.npm/_locks/ionic-870c91ec4eeb12ef.lock’ }
npm ERR! Linux 3.13.0-37-generic
npm ERR! argv “node” “/usr/local/bin/npm” “install” “-g” “cordova” "ionic"
npm ERR! node v0.10.37
npm ERR! npm v2.7.5

npm ERR! Attempt to unlock /usr/lib/node_modules/ionic, which hasn’t been locked
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR! https://github.com/npm/npm/issues

npm ERR! Please include the following file with any support request:
npm ERR! /home/francesco/npm-debug.log

but nothing… I don’t know… what’s problem

however i just do this:

francesco@francesco-K53BY ~ $ sudo ls -la /usr/local/bin/npm
lrwxrwxrwx 1 root root 38 apr 5 16:14 /usr/local/bin/npm -> …/lib/node_modules/npm/bin/npm-cli.js

and now…? I don’t know why I do this or better I think that is the right way… but I don’t know :smiley:

finally, I just tried this…

francesco@francesco-K53BY ~ $ ls -la /usr/bin/node
lrwxrwxrwx 1 root root 22 apr 5 23:49 /usr/bin/node -> /etc/alternatives/node
francesco@francesco-K53BY ~ $ brew install node
Comando “brew” non trovato. Forse si intendeva:
Comando “brec” dal pacchetto “bplay” (universe)
Comando “qbrew” dal pacchetto “qbrew” (universe)
brew: comando non trovato
francesco@francesco-K53BY ~ $ ionic start myapp tabs
Creating Ionic app in folder /home/francesco/myapp based on tabs project

Downloading: https://github.com/driftyco/ionic-app-base/archive/master.zip
[=============================] 100% 0.0s

Downloading: https://github.com/driftyco/ionic-starter-tabs/archive/master.zip
[=============================] 100% 0.0s

Update config.xml
Initializing cordova project
running cordova plugin add org.apache.cordova.device
Fetching plugin “org.apache.cordova.device” via plugin registry
Saving plugin to package.json file
Adding since there was no existingPlugin
running cordova plugin add org.apache.cordova.console
Fetching plugin “org.apache.cordova.console” via plugin registry
Saving plugin to package.json file
Adding since there was no existingPlugin
running cordova plugin add com.ionic.keyboard
Fetching plugin “com.ionic.keyboard” via plugin registry
Saving plugin to package.json file
Adding since there was no existingPlugin

Your Ionic project is ready to go! Some quick tips:

  • cd into your project: $ cd myapp

  • Setup this project to use Sass: ionic setup sass

  • Develop in the browser with live reload: ionic serve

  • Add a platform (ios or Android): ionic platform add ios [android]
    Note: iOS development requires OS X currently
    See the Android Platform Guide for full Android installation instructions:
    https://cordova.apache.org/docs/en/edge/guide_platforms_android_index.md.html

  • Build your app: ionic build

  • Simulate your app: ionic emulate

  • Run your app on a device: ionic run

  • Package an app using Ionic package service: ionic package

For more help use ionic --help or visit the Ionic docs: http://ionicframework.com/docs

±--------------------------------------------------------+

±--------------------------------------------------------+
francesco@francesco-K53BY ~ $ cd myapp
francesco@francesco-K53BY ~/myapp $ ionic platform add android
Downloading Default Ionic Resources

Downloading: https://github.com/driftyco/ionic-default-resources/archive/master.zip
[=============================] 100% 0.0s
Done adding default Ionic resources
Adding icons for platform: android
running cordova platform add android
Adding android project…
Creating Cordova project for the Android platform:
Path: platforms/android
Package: com.ionicframework.myapp442726
Name: myapp
Android target: android-21
Copying template files…
Project successfully created.
Running command: /home/francesco/myapp/hooks/after_prepare/010_add_platform_class.js /home/francesco/myapp
Installing “com.ionic.keyboard” for android
Installing “org.apache.cordova.console” for android
Installing “org.apache.cordova.device” for android
Saving platform to package.json file
francesco@francesco-K53BY ~/myapp $ ionic build android
running cordova build android
Running command: /home/francesco/myapp/hooks/after_prepare/010_add_platform_class.js /home/francesco/myapp
Running command: /home/francesco/myapp/platforms/android/cordova/build
[Error: ANDROID_HOME is not set and “android” command not in your PATH. You must fulfill at least one of these conditions.]
ERROR building one of the platforms: Error: /home/francesco/myapp/platforms/android/cordova/build: Command failed with exit code 2
You may not have the required environment or OS to build this project
Error: /home/francesco/myapp/platforms/android/cordova/build: Command failed with exit code 2
at ChildProcess.whenDone (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/superspawn.js:131:23)
at ChildProcess.emit (events.js:98:17)
at maybeClose (child_process.js:766:16)
at Process.ChildProcess._handle.onexit (child_process.js:833:5)
francesco@francesco-K53BY ~/myapp $

now… can you help me again? :slight_smile: thanks very much

[Error: ANDROID_HOME is not set and “android” command not in your PATH. You must fulfill at least one of these conditions.]

you need to

  1. download android sdk
  2. add env variable ANDROID_HOME

see how it works

I download and install android sdk
I look the post that you said but I didn’t understand what I must do…
sorry :frowning:

however I tried to do this:

export ANDROID_HOME=~/adt-bundle-linux-x86_64-20140702/sdk
export PATH=${PATH}:~/adt-bundle-linux-x86_64-20140702/sdk/tools
export PATH=${PATH}:~/adt-bundle-linux-x86_64-20140702/sdk/platform-tools
sudo apt-get install lib32stdc++6

and after I do this:

sudo npm install -g cordova ionic

… the result is always the same

francesco@francesco-K53BY ~ $ sudo npm install -g ionic cordovanpm WARN engine npm@1.3.4: wanted: {“node”:">=0.6",“npm”:“1”} (current: {“node”:“0.10.37”,“npm”:“2.7.5”})
npm WARN installMany normalize-package-data was bundled with npm@1.3.4, but bundled package wasn’t found in unpacked tree
/usr/bin/cordova -> /usr/lib/node_modules/cordova/bin/cordova
/usr/bin/ionic -> /usr/lib/node_modules/ionic/bin/ionic
cordova@4.3.0 /usr/lib/node_modules/cordova
├── underscore@1.7.0
├── q@1.0.1
├── nopt@3.0.1 (abbrev@1.0.5)
└── cordova-lib@4.3.0 (valid-identifier@0.0.1, osenv@0.1.0, properties-parser@0.2.3, bplist-parser@0.0.6, mime@1.2.11, semver@2.0.11, unorm@1.3.3, rc@0.5.2, shelljs@0.3.0, dep-graph@1.1.0, through2@0.6.3, npmconf@0.1.16, xcode@0.6.7, d8@0.4.4, init-package-json@1.3.2, elementtree@0.1.5, request@2.47.0, tar@1.0.2, glob@4.0.6, plist@1.1.0, cordova-js@3.8.0, npm@1.3.4)

ionic@1.3.19 /usr/lib/node_modules/ionic
├── proxy-middleware@0.7.0
├── connect-livereload@0.5.2
├── progress@1.1.7
├── colors@0.6.2
├── open@0.0.5
├── ncp@0.4.2
├── underscore@1.7.0
├── crc@3.2.1
├── async@0.9.0
├── q@1.0.1
├── cross-spawn@0.2.3 (lru-cache@2.5.0)
├── semver@4.3.1
├── shelljs@0.2.6
├── finalhandler@0.2.0 (escape-html@1.0.1, debug@2.0.0)
├── event-stream@3.0.20 (stream-combiner@0.0.4, duplexer@0.1.1, from@0.1.3, pause-stream@0.0.11, map-stream@0.0.5, split@0.2.10, through@2.3.6)
├── connect@3.1.1 (utils-merge@1.0.0, parseurl@1.3.0, finalhandler@0.1.0, debug@1.0.4)
├── optimist@0.6.0 (wordwrap@0.0.2, minimist@0.0.10)
├── form-data@0.1.4 (mime@1.2.11, combined-stream@0.0.7)
├── opbeat-ionic@1.1.3 (json-stringify-safe@5.0.0, console-log-level@1.0.0, stackman@0.2.2, after-all@2.0.1)
├── cli-table@0.3.1 (colors@1.0.3)
├── serve-static@1.7.1 (utils-merge@1.0.0, escape-html@1.0.1, parseurl@1.3.0, send@0.10.1)
├── tiny-lr-fork@0.0.5 (debug@0.7.4, faye-websocket@0.4.4, noptify@0.0.3, qs@0.5.6)
├── request@2.51.0 (caseless@0.8.0, json-stringify-safe@5.0.0, aws-sign2@0.5.0, forever-agent@0.5.2, stringstream@0.0.4, tunnel-agent@0.4.0, oauth-sign@0.5.0, node-uuid@1.4.3, qs@2.3.3, mime-types@1.0.2, combined-stream@0.0.7, tough-cookie@0.12.1, bl@0.9.4, http-signature@0.10.1, form-data@0.2.0, hawk@1.1.1)
├── unzip@0.1.9 (setimmediate@1.0.2, pullstream@0.4.1, readable-stream@1.0.33, match-stream@0.0.2, binary@0.3.0, fstream@0.1.31)
├── prompt@0.2.12 (revalidator@0.1.8, pkginfo@0.3.0, read@1.0.5, utile@0.2.1, winston@0.6.2)
├── vinyl-fs@0.3.7 (graceful-fs@3.0.6, strip-bom@1.0.0, vinyl@0.4.6, mkdirp@0.5.0, through2@0.6.3, glob-stream@3.1.18, lodash@2.4.1, glob-watcher@0.0.6)
├── archiver@0.5.1 (readable-stream@1.1.13, lazystream@0.1.0, zip-stream@0.1.4, lodash@2.4.1, file-utils@0.1.5)
├── gulp@3.8.8 (pretty-hrtime@0.2.2, interpret@0.3.10, deprecated@0.0.1, archy@0.0.2, minimist@1.1.1, tildify@1.0.0, semver@3.0.1, chalk@0.5.1, orchestrator@0.3.7, gulp-util@3.0.4, liftoff@0.12.1)
├── xml2js@0.4.4 (sax@0.6.1, xmlbuilder@2.6.2)
└── npm@2.1.3

finally I tried to do this and I see that the errors not founds (excepts the plugins)

francesco@francesco-K53BY ~ $ ionic start myapp tabs
Creating Ionic app in folder /home/francesco/myapp based on tabs project

The directory /home/francesco/myapp already exists.
Would you like to overwrite the directory with this new project?
(yes/no): yes

Downloading: https://github.com/driftyco/ionic-app-base/archive/master.zip
[=============================] 100% 0.0s

Downloading: https://github.com/driftyco/ionic-starter-tabs/archive/master.zip
[=============================] 100% 0.0s

Update config.xml
Initializing cordova project
running cordova plugin add org.apache.cordova.device
Fetching plugin “org.apache.cordova.device” via plugin registry
npm http GET http://registry.cordova.io/org.apache.cordova.device
npm http 304 http://registry.cordova.io/org.apache.cordova.device
Saving plugin to package.json file
Adding since there was no existingPlugin
running cordova plugin add org.apache.cordova.console
Fetching plugin “org.apache.cordova.console” via plugin registry
npm http GET http://registry.cordova.io/org.apache.cordova.console
npm http 304 http://registry.cordova.io/org.apache.cordova.console
Saving plugin to package.json file
Adding since there was no existingPlugin
running cordova plugin add com.ionic.keyboard
Fetching plugin “com.ionic.keyboard” via plugin registry
npm http GET http://registry.cordova.io/com.ionic.keyboard
npm http 304 http://registry.cordova.io/com.ionic.keyboard
Saving plugin to package.json file
Adding since there was no existingPlugin

Your Ionic project is ready to go! Some quick tips:

  • cd into your project: $ cd myapp

  • Setup this project to use Sass: ionic setup sass

  • Develop in the browser with live reload: ionic serve

  • Add a platform (ios or Android): ionic platform add ios [android]
    Note: iOS development requires OS X currently
    See the Android Platform Guide for full Android installation instructions:
    https://cordova.apache.org/docs/en/edge/guide_platforms_android_index.md.html

  • Build your app: ionic build

  • Simulate your app: ionic emulate

  • Run your app on a device: ionic run

  • Package an app using Ionic package service: ionic package

For more help use ionic --help or visit the Ionic docs: http://ionicframework.com/docs

±--------------------------------------------------------+

±--------------------------------------------------------+
francesco@francesco-K53BY ~ $

and finally I have this errors… so you have all of my flow :smile:

francesco@francesco-K53BY ~/myapp $ ionic platform add android
Downloading Default Ionic Resources

Downloading: https://github.com/driftyco/ionic-default-resources/archive/master.zip
[=============================] 100% 0.0s
Done adding default Ionic resources
Adding icons for platform: android
running cordova platform add android
npm http GET https://registry.npmjs.org/cordova-android/3.7.1
npm http 304 https://registry.npmjs.org/cordova-android/3.7.1
Adding android project…
Creating Cordova project for the Android platform:
Path: platforms/android
Package: com.ionicframework.myapp259937
Name: myapp
Android target: android-21
Copying template files…
Project successfully created.
Running command: /home/francesco/myapp/hooks/after_prepare/010_add_platform_class.js /home/francesco/myapp
Installing “com.ionic.keyboard” for android
Installing “org.apache.cordova.console” for android
Installing “org.apache.cordova.device” for android
Saving platform to package.json file
francesco@francesco-K53BY ~/myapp $ ionic build android
running cordova build android
Running command: /home/francesco/myapp/hooks/after_prepare/010_add_platform_class.js /home/francesco/myapp
Running command: /home/francesco/myapp/platforms/android/cordova/build
[Error: ANDROID_HOME is set to a non-existant path: /home/francesco/adt-bundle-linux-x86_64-20140702/sdk]
ERROR building one of the platforms: Error: /home/francesco/myapp/platforms/android/cordova/build: Command failed with exit code 2
You may not have the required environment or OS to build this project
Error: /home/francesco/myapp/platforms/android/cordova/build: Command failed with exit code 2
at ChildProcess.whenDone (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/superspawn.js:131:23)
at ChildProcess.emit (events.js:98:17)
at maybeClose (child_process.js:766:16)
at Process.ChildProcess._handle.onexit (child_process.js:833:5)
francesco@francesco-K53BY ~/myapp $

where did you put the android sdk library folder on your computer?