ionic2 fails during addressing to dev server running (ionic hello world) - javascript

ionic2 hello world does not work.
I am following get started on official site - https://ionicframework.com/docs/v2/intro/tutorial/
install cordova and ionic
ionic start probaionic --v2
cd probaionic
ionic serve
Everything is working fine - dev server running: http://localhost:8100/
When I try to address this URL, I get this error:
traineeProgram/probaionic/node_modules/#ionic/app-scripts/dist/dev-server /live-reload.js:27
var contentStr = content.toString();
^
TypeError: Cannot read property 'toString' of undefined
at Object.injectLiveReloadScript (/media/volodymyr/Media/[[1]] work/[8]programming/[1]keenethics/traineeProgram/probaionic/node_modules/#ionic/app-scripts/dist/dev-server/live-reload.js:27:29)
at ReadFileContext.callback (/media/volodymyr/Media/[[1]] work/[8]programming/[1]keenethics/traineeProgram/probaionic/node_modules/#ionic/app-scripts/dist/dev-server/http-server.js:62:39)
at FSReqWrap.readFileAfterOpen [as oncomplete] (fs.js:365:13)
npm ERR! Linux 4.4.0-57-generic
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "run" "ionic:serve" "--" "--v2" "--address" "0.0.0.0" "--port" "8100" "--livereload-port" "35729"
npm ERR! node v6.9.5
npm ERR! npm v4.1.2
npm ERR! code ELIFECYCLE
npm ERR! ionic-hello-world# ionic:serve: `ionic-app-scripts serve "--v2" "--address" "0.0.0.0" "--port" "8100" "--livereload-port" "35729"`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the ionic-hello-world# ionic:serve script 'ionic-app-scripts serve "--v2" "--address" "0.0.0.0" "--port" "8100" "--livereload-port" "35729"'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the ionic-hello-world package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! ionic-app-scripts serve "--v2" "--address" "0.0.0.0" "--port" "8100" "--livereload-port" "35729"
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs ionic-hello-world
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls ionic-hello-world
npm ERR! There is likely additional logging output above.

I faced the same issue with the below warning
****************************************************** Dependency
warning - for the CLI to run correctly, it is highly recommended to
install/upgrade the following: Please install your Cordova CLI to
version >=4.2.0 npm install -g cordova Install ios-sim to deploy iOS
applications. npm install -g ios-sim (may require sudo) Install
ios-deploy to deploy iOS applications to devices. npm install -g
ios-deploy (may require sudo)
try, running cordova -v command you will be opted with the below question
? May Cordova anonymously report usage statistics to improve the tool over time? No
I used no and it showed the version was 6.5.0
You have been opted out of telemetry. To change this, run: cordova telemetry on.
6.5.0
I ran the ionic serve command again and it worked.

Related

npm ERR! ERESOLVE unable to resolve dependency tree. Clone repository

MINGW64 ~/Downloads/Eshop_mobile_app_react_native (master)
$ npm install
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: Eshop#1.0.0
npm ERR! Found: react#17.0.2
npm ERR! node_modules/react
npm ERR! react#"17.0.2" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react#"^18.2.0" from react-dom#18.2.0
npm ERR! node_modules/react-dom
npm ERR! react-dom#"^18.0.0" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR!
npm ERR! See C:\Users\PC\AppData\Local\npm-cache\eresolve-report.txt for a full report.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\PC\AppData\Local\npm-cache\_logs\2023-01-04T22_30_23_958Z-debug-0.log
I tried running npm install --legacy-peer-deps and tried running $ npx react-native run-android but the build is failing, and I don't know what to do anymore.
MINGW64 ~/Downloads/Eshop_mobile_app_react_native (master)
$ npx react-native run-android
info Running jetifier to migrate libraries to AndroidX. You can disable it using "--no-jetifier" flag.
Jetifier found 1735 file(s) to forward-jetify. Using 8 workers...
info Starting JS server...
info Launching emulator...
info Successfully launched emulator.
info Installing the app...
> Task :react-native-gradle-plugin:compileJava
> Configure project :app
Unable to detect AGP versions for included builds. All projects in the build should use the same AGP version. Class name for the included build object: org.gradle.composite.internal.DefaultIncludedBuild$IncludedBuildImpl_Decorated.
> Configure project :lottie-react-native
> Configure project :react-native-reanimated
AAR for react-native-reanimated has been found
C:\Users\PC\Downloads\Eshop_mobile_app_react_native\node_modules\react-native-reanimated\android\react-native-reanimated-68-jsc.aar
Note: C:\Users\PC\Downloads\Eshop_mobile_app_react_native\android\app\src\debug\java\com\eshop\ecommerce\ReactNativeFlipper.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
2 errors
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':app:compileDebugJavaWithJavac'.
> Compilation failed; see the compiler error output for details.
* Get more help at https://help.gradle.org
BUILD FAILED in 48s
at makeError (C:\Users\PC\Downloads\Eshop_mobile_app_react_native\node_modules\#react-native-community\cli-platform-android\node_modules\execa\index.js:174:9)
at C:\Users\PC\Downloads\Eshop_mobile_app_react_native\node_modules\#react-native-community\cli-platform-android\node_modules\execa\index.js:278:16
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async runOnAllDevices (C:\Users\PC\Downloads\Eshop_mobile_app_react_native\node_modules\#react-native-community\cli-platform-android\build\commands\runAndroid\runOnAllDevices.js:109:5)
at async Command.handleAction (C:\Users\PC\Downloads\Eshop_mobile_app_react_native\node_modules\#react-native-community\cli\build\index.js:192:9)
info Run CLI with --verbose flag for more details.

Azure deploy error errno 47

I'm trying to deploy a nodeJS application in azure. In deployment i have the npm ERR! errno 47.
Maybe can help that i had exceded the maximum character paths while developing, which i fixed it locally.
All answers would be appreciate.
Command: "D:\home\site\deployments\tools\deploy.cmd"
Handling node.js deployment.
KuduSync.NET from: 'D:\home\site\repository' to: 'D:\home\site\wwwroot'
Copying file: 'index.js'
Copying file: 'mmfrontend-crm-node.njsproj'
Copying file: 'package.json'
Node.js versions available on the platform are: 0.6.17, 0.6.20, 0.8.2, 0.8.19, 0.8.26, 0.8.27, 0.8.28, 0.10.5, 0.10.18, 0.10.21, 0.10.24, 0.10.26, 0.10.28, 0.10.29, 0.10.31, 0.10.32, 0.12.0.
Selected node.js version 0.10.32. Use package.json file to choose a different version.
Updating iisnode.yml at D:\home\site\wwwroot\iisnode.yml
npm WARN package.json mmfrontend-crm-node#1.0.0 No description
npm WARN package.json mmfrontend-crm-node#1.0.0 No repository field.
npm WARN deprecated gulp-clean#0.3.1: use gulp-rimraf instead
npm WARN engine imagemin#2.2.1: wanted: {"node":">=0.10.0","npm":">=2.1.5"} (current: {"node":"0.10.32","npm":"1.4.28"})
npm WARN optional dep failed, continuing imagemin-pngquant#4.0.0
npm WARN optional dep failed, continuing imagemin-optipng#4.2.0
npm WARN optional dep failed, continuing imagemin-jpegtran#4.1.0
npm WARN optional dep failed, continuing imagemin-gifsicle#4.1.0
npm ERR! EEXIST, open 'D:\local\AppData\npm-cache\5428a087-m-cache-wrappy-1-0-1-package-tgz.lock'
File exists: D:\local\AppData\npm-cache\5428a087-m-cache-wrappy-1-0-1-package-tgz.lock
Move it away, and try again.
npm ERR! System Windows_NT 6.2.9200
npm ERR! command "D:\\Program Files (x86)\\nodejs\\0.10.32\\node.exe" "D:\\Program Files (x86)\\npm\\1.4.28\\node_modules\\npm\\bin\\npm-cli.js" "install" "--production"
npm ERR! cwd D:\home\site\wwwroot
npm ERR! node -v v0.10.32
npm ERR! npm -v 1.4.28
npm ERR! path D:\local\AppData\npm-cache\5428a087-m-cache-wrappy-1-0-1-package-tgz.lock
npm ERR! code EEXIST
npm ERR! errno 47
Failed exitCode=47, command="D:\Program Files (x86)\nodejs\0.10.32\node.exe" "D:\Program Files (x86)\npm\1.4.28\node_modules\npm\bin\npm-cli.js" install --production
An error has occurred during web site deployment.
Redeploy worked, a bit strange with azure

Can't run npm install without sudo. Setting permissions to .npm didn't work

Im running Ubuntu 14.04 and have installed nodejs from the ppa https://launchpad.net/~chris-lea/+archive/ubuntu/node.js. When ever I try to run npm install it gives an error like this : (running the command npm install -g generator-ember)
npm ERR! Error: EACCES, unlink '/usr/lib/node_modules/generator-ember'
npm ERR! { [Error: EACCES, unlink '/usr/lib/node_modules/generator-ember']
npm ERR! errno: 3,
npm ERR! code: 'EACCES',
npm ERR! path: '/usr/lib/node_modules/generator-ember' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
npm ERR! System Linux 3.13.0-37-generic
npm ERR! command "/usr/bin/node" "/usr/bin/npm" "install" "-g" "generator-ember"
npm ERR! cwd /home/pubudu/Projects/techpro-yeoman
npm ERR! node -v v0.10.32
npm ERR! npm -v 1.4.28
npm ERR! path /usr/lib/node_modules/generator-ember
npm ERR! code EACCES
npm ERR! errno 3
npm ERR! stack Error: EACCES, unlink '/usr/lib/node_modules/generator-ember'
npm ERR! error rolling back Error: EACCES, unlink '/usr/lib/node_modules/generator-ember'
npm ERR! error rolling back { [Error: EACCES, unlink '/usr/lib/node_modules/generator-ember']
npm ERR! error rolling back errno: 3,
npm ERR! error rolling back code: 'EACCES',
npm ERR! error rolling back path: '/usr/lib/node_modules/generator-ember' }
npm ERR! not ok code 0
I tried setting the permissions like this : sudo chown -R yourusername ~/.npm but it didn't work. How can I fix this? I can run npm with sudo but if I do, later im running into permission problems like when using grunt.
I had manies an issue with this too.
Changing the ownership of ~/.npm isnt enough because you are also getting access issues in /usr/lib/node_modules/ folders. You can change permissions here too if you like but changing permissions on folders is not recommended. If you were to change permissions on these folders too only do it on the folder you need ie the node_modules folder. Or you could go a different, more preffered, route -
Originally I went in and changed permissions of folders and all of that jazz but when I upgraded my system I used NVM.
From the ember-cli page, the link below leads to a tutorial about how to use npm and nodejs without using sudo by using node version manager:
http://www.wenincode.com/installing-node-jsnpm-without-sudo/
Once you have installed nvm as the tutorial above or as the github page tells you then whenever you log into a new shell you just use the command:
nvm use 0.10
where 0.10 is the version of nodejs you want to use.

Installing Inotify with NPM

I'm quite new to nodeJS and I'm trying to install a package called inotify using the Node Package Manager (NPM).
After installing NPM (on OSX Lion), I tried to install inotify with the command:
sudo npm install inotify
And I get the following error:
npm http GET https://registry.npmjs.org/inotify
npm http 304 https://registry.npmjs.org/inotify
> inotify#0.2.2 install /usr/local/lib/node_modules/inotify
> node-waf configure build
Checking for program g++ or c++ : /usr/bin/g++
Checking for program cpp : /usr/bin/cpp
Checking for program ar : /usr/bin/ar
Checking for program ranlib : /usr/bin/ranlib
Checking for g++ : ok
Checking for node path : not found
Checking for node prefix : ok /usr/local/Cellar/node/0.6.6
Checking for program node : /usr/local/bin/node
Checking for function inotify_init : not found
/usr/local/lib/node_modules/inotify/src/wscript:11: error: the configuration failed (see '/usr/local/lib/node_modules/inotify/build/config.log')
npm ERR! error installing inotify#0.2.2
npm ERR! inotify#0.2.2 install: `node-waf configure build`
npm ERR! `sh "-c" "node-waf configure build"` failed with 1
npm ERR!
npm ERR! Failed at the inotify#0.2.2 install script.
npm ERR! This is most likely a problem with the inotify package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node-waf configure build
npm ERR! You can get their info via:
npm ERR! npm owner ls inotify
npm ERR! There is likely additional logging output above.
npm ERR!
npm ERR! System Darwin 11.2.0
npm ERR! command "node" "/usr/local/bin/npm" "install" "-g" "inotify"
npm ERR! cwd /Users/username/code
npm ERR! node -v v0.6.6
npm ERR! npm -v 1.1.4
npm ERR! code ELIFECYCLE
npm ERR! message inotify#0.2.2 install: `node-waf configure build`
npm ERR! message `sh "-c" "node-waf configure build"` failed with 1
npm ERR! errno {}
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /Users/username/code/npm-debug.log
npm not ok
Can someone help me out with this
The inotify module won't build because it can't find inotify_init. This is because inotify is not available on OS X.
The FSEvents API on OS X provides similar functionality, but it's a completely different API. The inotify module is not going to work in this situation.
Depending on what you are trying to do, fs.watch might suit your needs. It abstracts away platform differences:
On Linux systems, this uses inotify.
On BSD systems (including OS X), this uses kqueue.
On SunOS systems (including Solaris and SmartOS), this uses event ports.
On Windows systems, this feature depends on ReadDirectoryChangesW.

Error trying to install npm for Node.js

I'm having a stab at learning Node.js and I'm having a few issues when installing NPM (Node Package Manager). I'm pretty sure it's either a permissions thing or folder thing... please note that I've just purchased a Mac (I've used Windows all my life) and I'm pretty unfamiliar with the Mac terminal.
Okay, I went to use the one line install for NPM: curl http://npmjs.org/install.sh | sh and I got an error...
All clean!
! [ -d .git ] || git submodule update --init --recursive
node cli.js rm npm -g -f
node cli.js install -g -f
npm ERR! Could not create /usr/local/lib/node_modules/___npm.npm
npm ERR! error installing npm#1.0.94 Error: EACCESS, Undefined error: 0 '/usr/local/lib/node_modules'
npm ERR! Error: EACCESS, Undefined error: 0 '/usr/local/lib/node_modules'
npm ERR! Report this *entire* log at:
npm ERR! <http://github.com/isaacs/npm/issues>
npm ERR! or email it to:
npm ERR! <npm-#googlegroups.com>
npm ERR!
npm ERR! System Darwin 11.0.0
npm ERR! command "node" "/private/var/folders/z2/f05c8hx105g79drh6r7hr01w0000gn/T/npm.1219/package/cli.js" "install" "-g" "-f"
npm ERR! cwd /private/var/folders/z2/f05c8hx105g79drh6r7hr01w0000gn/T/npm.1219/package
npm ERR! node -v v0.5.9-pre
npm ERR! npm -v 1.0.94
npm ERR! path /usr/local/lib/node_modules
npm ERR! code EACCESS
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /private/var/folders/z2/f05c8hx105g79drh6r7hr01w0000gn/T/npm.1219/package/npm-debug.log
npm not ok
make: *** [install] Error 1
npm ERR! Could not create /usr/local/lib/node_modules/___npm.npm
npm ERR! error installing npm#1.0.94 Error: EACCESS, Undefined error: 0 '/usr/local/lib/node_modules'
npm ERR! Error: EACCESS, Undefined error: 0 '/usr/local/lib/node_modules'
npm ERR! Report this *entire* log at:
npm ERR! <http://github.com/isaacs/npm/issues>
npm ERR! or email it to:
npm ERR! <npm-#googlegroups.com>
npm ERR!
npm ERR! System Darwin 11.0.0
npm ERR! command "/usr/local/bin/node" "/private/var/folders/z2/f05c8hx105g79drh6r7hr01w0000gn/T/npm.1219/package/cli.js" "install" "-gf"
npm ERR! cwd /private/var/folders/z2/f05c8hx105g79drh6r7hr01w0000gn/T/npm.1219/package
npm ERR! node -v v0.5.9-pre
npm ERR! npm -v 1.0.94
npm ERR! path /usr/local/lib/node_modules
npm ERR! code EACCESS
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /private/var/folders/z2/f05c8hx105g79drh6r7hr01w0000gn/T/npm.1219/package/npm-debug.log
npm not ok
It failed
there's obviously a folder issue here, perhaps I'm installing in the wrong place, my node folder is at Users/Mike/node, when I try and find out my node path variable using NODE_PATH I get the following error:
Michaels-MacBook-Pro:~ Mike$ node node/NODE_PATH
node.js:203
throw e; // process.nextTick error, or 'error' event on first tick
^
Error: Cannot find module '/Users/Mike/node/NODE_PATH'
at Function._resolveFilename (module.js:334:11)
at Function._load (module.js:279:25)
at Array.<anonymous> (module.js:470:10)
at EventEmitter._tickCallback (node.js:195:26)
Can someone please tell me what I'm doing wrong? Do I need to add the node path like such:
$ export PATH=/path/to/node/0.n.y/bin:${PATH}
$ curl http://npmjs.org/install.sh | sh
Or am I confusing myself?
The permissions on /usr/local require you to use sudo to install NPM, or change your permissions. Of these three, I recommend the third option.
Option #1: Use sudo
(Note that the the creator of NPM advises against using this method)
curl http://npmjs.org/install.sh | sudo sh
Option #2: Change permissions
sudo chmod g+rwx /usr/local
sudo chgrp admin /usr/local
Option #3: Use Homebrew
I recommend installing Homebrew to manage installing *nix tools on OS X (I'd stay away from MacPorts & Fink). Installing Homebrew will set the permissions for /usr/local so you can write to it without sudo. You can then install Node via Homebrew, and then install NPM normally:
brew install node --without-npm
curl http://npmjs.org/install.sh | sh
Use curl http://npmjs.org/install.sh | sudo sh.
Edit: You're using node -v v0.5.9-pre, which is very unstable. Use 0.4.12, the latest stable version.
if you are using windows , it takes some steps , 1) create a file called package.json
{
"name": "hello"
, "version": "0.0.1"
, "dependencies": {
"express": "*"
}
}
where hello is the name of the package and * means the latest version of your dependency
2) code to you project directory and run the following command
npm install
As update for the method #3 on OSX the correct command now is:
brew install node --without-npm
curl https://www.npmjs.org/install.sh | sh
Option #4:
Install node local to the user that needs it.
I should clarify for my purposes I needed npm to install appium on an OSX server running Bamboo for our integrated testing. I only had macports available and rather than installing homebrew to manage just the one package I decided to build it from source and install it local to the bamboo user. Which allowed us to run appium as the bamboo user and made it possible to run our appium tests on Bamboo as a not very privileged user.
This guide from Tom Novelli goes over how to do it. The basic gist is:
# Make the dir to hold the installation of node
cd
mkdir ./local
mkdir sources
# Tell npm about your new non-default directories
vi .npmrc
cd sources
# Get node and do the typical source install procedure
wget http://nodejs.org/dist/v0.10.29/node-v0.10.29.tar.gz
tar xf node-v0.10.29.tar.gz
cd node-v8.10.29/
# Important part is the --prefix
./configure --prefix=~/.local
make
make install
# Make a link so node doesn't get confused
cd
ln -s .local/lib/node_modules .node_modules
# Edit PATH to include ~/.local
vi .bashrc
.npmrc
root = /home/YOUR-USERNAME/.local/lib/node_modules
binroot = /home/YOUR-USERNAME/.local/bin
manroot = /home/YOUR-USERNAME/.local/share/man
.bashrc OR .profile OR whereever you like setting your path
export PATH=$HOME/.local/bin:$PATH
Useful Links
The .npmrc man page useful.
And just in case here's a link to node source.

Categories