I'm using NS 2.3.0 and when I start tns run android (and iOS too), there is an error that says:
Processing node_modules failed. SyntaxError:/Users/ledinh/Smarp/node_modules/npm/node_modules/read-package-tree/test/fixtures/empty/node_modules/foo/package.json: Unexpected end of input
This was actually happening to me since 2.2, updating to 2.3 does not solve problem. Even the tns doctor said that no issues were detected. Any help would be much appreciated.
EDIT: Here is my package.json
{
"devDependencies": {
"babel-traverse": "6.15.0",
"babel-types": "6.15.0",
"babylon": "6.9.2",
"lazy": "1.0.11",
"nativescript-dev-typescript": "^0.2.3",
"typescript": "^1.7.5"
},
"nativescript": {
"id": "com.smarpsocial.smarpshare",
"tns-ios": {
"version": "2.3.0"
},
"tns-android": {
"version": "2.3.0"
}
},
"scripts": {
"dummy": "echo yay",
"ios": "xcproj --project platforms/ios/SmarpShare.xcodeproj touch; xcproj --project platforms/ios/Pods/Pods.xcodeproj touch; tns livesync ios --emulator --watch",
"test-json-schema": "echo 'Not yet implemented';exit 1;"
},
"dependencies": {
"app-data": "file:setup_assets/plugins/app-data",
"jed": "1.1.0",
"moment": "^2.10.6",
"nativescript-appversion": "^1.1.2",
"nativescript-appwidget": "file:setup_assets/plugins/nativescript-appwidget",
"nativescript-clipboard": "^1.1.3",
"nativescript-facebook-login": "^0.2.0",
"nativescript-fresco": "file:setup_assets/plugins/nativescript-fresco",
"nativescript-iqkeyboardmanager": "^1.0.1",
"nativescript-logEntries": "^1.0.0",
"nativescript-pulltorefresh": "^1.1.0",
"nativescript-push-notifications": "0.0.15",
"nativescript-snackbar": "^1.0.3",
"nativescript-timedatepicker": "file:setup_assets/plugins/timedatepicker",
"nativescript-zendesk": "file:setup_assets/plugins/nativescript-zendesk",
"simple-text-parser": "1.0.0",
"tns-core-modules": "^2.3.0",
"util": "~0.10.3"
}
}
EDIT 2: I created a sample app and it works, but not for my app
I suspect it's because the platforms / tns-core-modules packages in your app have a lower version than what's specified in package.json.
Can you try following these instructions? So:
$ tns platform remove android
$ tns platform add android
$ tns platform remove ios
$ tns platform add android
$ npm install tns-core-modules#latest --save
Related
this is the message I read in the console :
the Firebase plugin is not installed when trying to run my project on a device on Xcode.
I have recently downgraded to Firebase 4.8.0 for dependencies compatibility issues.
I made sure to add my GoogleService-info.plist to the root of my ionic project and to the Xcode project.
I checked my node_modules: #ionic-native/firebase. everything is there
There is no error. The app runs properly, excepts that the Firebase plugin does not seem to be found.
I have tried to uninstall et re-install. no success
What to do in this case?
this is my package.json:
{
"name": "authNotificationTest",
"version": "0.0.1",
"author": "Ionic Framework",
"homepage": "http://ionicframework.com/",
"private": true,
"scripts": {
"clean": "ionic-app-scripts clean",
"build": "ionic-app-scripts build",
"lint": "ionic-app-scripts lint",
"ionic:build": "ionic-app-scripts build",
"ionic:serve": "ionic-app-scripts serve"
},
"dependencies": {
"#angular/animations": "5.2.10",
"#angular/common": "5.2.10",
"#angular/compiler": "5.2.10",
"#angular/compiler-cli": "5.2.10",
"#angular/core": "5.2.10",
"#angular/forms": "5.2.10",
"#angular/http": "5.2.10",
"#angular/platform-browser": "5.2.10",
"#angular/platform-browser-dynamic": "5.2.10",
"#ionic-native/core": "4.7.0",
"#ionic-native/fcm": "^4.7.0",
"#ionic-native/firebase": "^4.7.0",
"#ionic-native/splash-screen": "4.7.0",
"#ionic-native/status-bar": "4.7.0",
"#ionic/storage": "2.1.3",
"angularfire2": "5.0.0-rc.3",
"cordova-browser": "5.0.3",
"cordova-ios": "4.5.4",
"cordova-plugin-device": "^2.0.2",
"cordova-plugin-fcm": "^2.1.2",
"cordova-plugin-fcm-plus": "git+https://github.com/guyromb/cordova-plugin-fcm-plus.git",
"cordova-plugin-firebase": "^1.0.2",
"cordova-plugin-ionic-keyboard": "^2.0.5",
"cordova-plugin-ionic-webview": "^1.2.1",
"cordova-plugin-splashscreen": "^5.0.2",
"cordova-plugin-whitelist": "^1.3.3",
"firebase": "^4.8.0",
"ionic-angular": "3.9.2",
"ionicons": "3.0.0",
"rxjs": "5.5.10",
"sw-toolbox": "3.6.0",
"zone.js": "0.8.26"
},
"devDependencies": {
"#ionic/app-scripts": "3.1.9",
"typescript": "~2.6.2"
},
"description": "An Ionic project",
"cordova": {
"plugins": {
"cordova-plugin-fcm": {},
"cordova-plugin-firebase": {},
"cordova-plugin-whitelist": {},
"cordova-plugin-device": {},
"cordova-plugin-splashscreen": {},
"cordova-plugin-ionic-webview": {},
"cordova-plugin-ionic-keyboard": {}
}
}
}
and, my ionic info:
li packages: (/usr/local/lib/node_modules)
#ionic/cli-utils : 1.19.2
ionic (Ionic CLI) : 3.20.0
global packages:
cordova (Cordova CLI) : 8.0.0
local packages:
#ionic/app-scripts : 3.1.9
Cordova Platforms : browser 5.0.3 ios 4.5.4
Ionic Framework : ionic-angular 3.9.2
System:
Node : v9.11.1
npm : 6.0.0
OS : macOS High Sierra
Xcode : Xcode 9.3 Build version 9E145
Environment Variables:
ANDROID_HOME : not set
Misc:
backend : pro
Try to run:-
ionic cordova plugin add cordova-plugin-firebase
npm install --save #ionic-native/firebase
For more info visit:- https://ionicframework.com/docs/native/firebase/
Got this issue after ejecting from Expo (with ExpoKit). Had a working environment before ejecting. npm run ios will run with this issue repeating over and over:
Origin: Worker (PID 6336) 12:18:06: [Error] Error: getaddrinfo
ENOTFOUND lcalhost 12:18:06: at errnoException (dns.js:28:10)
12:18:06: at GetAddrInfoReqWrap.onlookup [as oncomplete]
(dns.js:76:26)
Expo XDE will not run at all and repeats this message. XCode includes C++11 compiler.
Error: Compilation of µWebSockets has failed and there is no
pre-compiled binary available for your system. Please install a
supported C++11 compiler and reinstall the module 'uws'.
package.json
{
"name": "OurApp",
"version": "0.0.1",
"private": true,
"devDependencies": {
"babel-eslint": "^8.0.3",
"eslint": "^4.13.1",
"eslint-config-airbnb": "^16.1.0",
"eslint-plugin-import": "^2.8.0",
"eslint-plugin-jsx-a11y": "^6.0.3",
"eslint-plugin-react": "^7.5.1",
"jest-expo": "^23.0.0",
"react-native-scripts": "1.8.1",
"react-test-renderer": "16.0.0",
"remotedev-rn-debugger": "^0.8.3"
},
"main": "./node_modules/react-native-scripts/build/bin/crna-entry.js",
"scripts": {
"start": "react-native-scripts start",
"eject": "react-native-scripts eject",
"android": "react-native-scripts android",
"ios": "react-native-scripts ios",
"test": "node node_modules/jest/bin/jest.js --watch",
"postinstall": "remotedev-debugger --hostname lcalhost --port 5678 --injectserver",
"eslint": "./node_modules/.bin/eslint"
},
"remotedev": {
"hostname": "localhost",
"port": 5678
},
"jest": {
"preset": "jest-expo"
},
"dependencies": {
"#expo/vector-icons": "^6.2.1",
"axios": "^0.17.1",
"expo": "^23.0.0",
"lodash": "^4.17.4",
"prop-types": "^15.6.0",
"react": "16.0.0",
"react-native": "https://github.com/expo/react-native/archive/sdk-23.0.0.tar.gz",
"react-native-elements": "^0.18.5",
"react-native-maps": "^0.19.0",
"react-navigation": "^1.0.0-beta.19",
"react-navigation-redux": "^0.1.0",
"react-redux": "^5.0.6",
"redux": "^3.7.2",
"redux-logger": "^3.0.6",
"redux-promise": "^0.5.3",
"redux-thunk": "^2.2.0",
"remote-redux-devtools": "^0.5.12"
}
}
app.json
{
"expo": {
"isDetached": false,
"privacy": "unlisted",
"sdkVersion": "23.0.0",
"orientation": "portrait",
"primaryColor": "#ffde00",
"name": "OurApp",
"description": "Desc",
"icon": "./resources/icon.png",
"version": "0.0.1",
"slug": "our-app",
"scheme": "ourapp",
"ios": {
"bundleIdentifier": "se.comp.expo",
"config": {
"googleMapsApiKey": "key"
},
"buildNumber": "1.0.0",
"isRemoteJSEnabled": true,
"supportsTablet": false,
"associatedDomains": [
"myDomain.com"
]
},
"android": {
"package": "se.comp.expo",
"versionCode": 1,
"config": {
"googleMaps": {
"apiKey": "key"
}
},
"permissions": [
"CAMERA",
"ACCESS_FINE_LOCATION"
]
},
"notification": {
"icon": "./resources/icon_notify.png",
"color": "#ffde00",
"androidMode": "collapse",
"androidCollapsedTitle": "#{unread_notifications} new"
},
"loading": {
"icon": "./resources/icon.png",
"backgroundColor": "#000000",
"backgroundImage": "./resources/splash.png",
"hideExponentText": true
},
"splash": {
"backgroundColor": "#000000",
"image": "./resources/splash.png",
"resizeMode": "cover"
},
"androidStatusBar": {
"barStyle": "dark-content",
"backgroundColor": "#ffde00"
},
"facebookAppId": "id",
"facebookDisplayName": "OurApp",
"facebookScheme": "fbId",
"androidShowExponentNotificationInShellApp": true
}
}
As #SyedZainAli mentioned this might be caused by environment. A few things to try then is:
Remove node_modules, run npm cache clean and reinstall
Reinstall NodeJS
Create a new app using CRNA and compare
In my case ejecting and using Expo react-native branch (default behavior) causes the issue. Changing back to official react-native npm package resolves the issue. So should be something on Expo's side.
I don't know if this may help you, but it fixed my issue within docker.
In Docker file
//////////////////////////////////////////////////////////////////////////
FROM node:8.9-alpine
RUN apk add --update \
libc6-compat
//////////////////////////////////////////////////////////////////////////
Needed libc6-compact
so try installing libc6-compat.
I had the same issue (below) when I was trying the start an app I got from my team in Expo. And it turned out that uws version in the project was not compatible with the Node version I was using. - node v10.15.0
Switching the node version to be 8.11.4 using nvm - nvm use 8.11.4 solved my issue. (If there is no 8.11.4 version installed use nvm install 8.11.4 instead)
$ expo start
Starting project at /Users/dugong/development/myApp
Expo DevTools is running at http://localhost:19002
Opening DevTools in the browser... (press shift-d to disable)
oteDev] Start server...
--------------------------------------------------------------------------------
[Busy] Launching SocketCluster
1555352786943 - Origin: Worker (PID 63541)
[Error] Error: Compilation of µWebSockets has failed and there is no pre-compiled binary available for your system. Please install a supported C++11 compiler and reinstall the module 'uws'.
at native (/Users/dugong/development/myApp/node_modules/socketcluster-server/node_modules/uws/uws.js:38:19)
I just upgraded my from ionic 2 to ionic 3. but now it is stuck at splash screen with error:
Cannot find module "d3"
here is my ionic info :
Cordova CLI: 6.4.0
Ionic Framework Version: 3.0.1
Ionic CLI Version: 2.2.1
Ionic App Lib Version: 2.2.0
Ionic App Scripts Version: 1.3.0
ios-deploy version: Not installed
ios-sim version: Not installed
OS: Windows 10
Node Version: v6.9.1
Xcode version: Not installed
Package.json
{
"name": "MyApp",
"author": "",
"homepage": "http://ionicframework.com/",
"private": true,
"scripts": {
"clean": "ionic-app-scripts clean",
"build": "ionic-app-scripts build",
"ionic:build": "ionic-app-scripts build",
"ionic:serve": "ionic-app-scripts serve"
},
"dependencies": {
//dependencies starts here. have updated these according to ionic 3
"#angular/common": "4.0.0",
"#angular/compiler": "4.0.0",
"#angular/compiler-cli": "4.0.0",
"#angular/core": "4.0.0",
"#angular/forms": "4.0.0",
"#angular/http": "4.0.0",
"#angular/platform-browser": "4.0.0",
"#angular/platform-browser-dynamic": "4.0.0",
"#angular/platform-server": "2.2.1",
"#ionic-native/core": "^3.10.3",
"#ionic-native/keyboard": "^3.4.4",
"#ionic-native/splash-screen": "3.4.2",
"#ionic-native/status-bar": "3.4.2",
"#ionic/cloud-angular": "^0.10.0",
"#ionic/storage": "2.0.1",
"angular2-moment": "^1.1.0",
"google-libphonenumber": "^2.0.14",
"ionic-angular": "3.0.1",
"ionic-gallery-modal": "0.0.7",
"ionic-native": "2.2.11",
"ionicons": "3.0.0",
"rxjs": "5.1.1",
"sw-toolbox": "3.4.0",
"zone.js": "^0.8.4"
},
"devDependencies": {
"#ionic/app-scripts": "1.3.0",
"#ionic/cli-plugin-cordova": "1.1.2",
"#ionic/cli-plugin-ionic-angular": "1.1.2",
"typescript": "2.1"
},
"cordovaPlugins": [
"ionic-plugin-keyboard",
"cordova-plugin-whitelist",
"cordova-plugin-console",
"cordova-plugin-statusbar",
"cordova-plugin-device",
"cordova-plugin-splashscreen",
"cordova-sqlite-storage",
"cordova-plugin-x-toast",
"cordova-plugin-camera",
"cordova-plugin-compat",
"cordova-plugin-image-picker",
"cordova.plugins.diagnostic",
{
"id": "phonegap-plugin-push",
"locator": "phonegap-plugin-push",
"variables": {
"SENDER_ID": "XXXXXXXXXXX"
}
},
"cordova-plugin-appavailability",
"ionic-plugin-deploy",
"cordova-plugin-x-socialsharing",
"cordova-plugin-screen-orientation",
"com.hutchind.cordova.plugins.streamingmedia",
"cordova-plugin-contacts",
"ionic-plugin-deploy",
"cordova-plugin-x-socialsharing",
{
"locator": "https://github.com/napolitano/cordova-plugin-intent",
"id": "com.napolitano.cordova.plugin.intent"
},
"cordova-plugin-screen-orientation",
"cordova-plugin-file",
"cordova-plugin-file-transfer"
],
"cordovaPlatforms": [
{
"platform": "android",
"version": "",
"locator": "android"
}
],
"description": "An Ionic project"
}
Followed this link for the upgrade
Install d3 to package.json.
npm install d3 --save
Install the type declarations from npm:
npm install #types/d3 --save-dev
You dont need typings. It is deprecated.
The same for jquery.
used following set of commands to solve:
npm install d3#vSpecify_your_version --save
npm install -g typings --save
typings search d3 --save
typings install d3 --save
npm install jquery --save
typings install dt~jquery --global --save
npm install aws-sdk --save
Then delete the node_modules folder of your project and do npm install in your projects CMD/Terminal.
I'm building a NativeScript app. For implementing Drawer, I'm trying to use 'Telerik NativeScript UI' plugin. But, something is not working after installing the plugin & my NativeScript build is getting failed.
Here are 2 screenshots of the build failed.
My package.json file content
{
"description": "NativeScript Application",
"license": "SEE LICENSE IN <your-license-filename>",
"readme": "NativeScript Application",
"repository": "<fill-your-repository-here>",
"nativescript": {
"id": "org.nativescript.testapp",
"tns-android": {
"version": "2.0.0"
}
},
"dependencies": {
"#angular/common": "2.0.0-rc.1",
"#angular/compiler": "2.0.0-rc.1",
"#angular/core": "2.0.0-rc.1",
"#angular/platform-browser": "2.0.0-rc.1",
"#angular/platform-browser-dynamic": "2.0.0-rc.1",
"#angular/platform-server": "2.0.0-rc.1",
"#angular/router-deprecated": "2.0.0-rc.1",
"nativescript-angular": "0.1.1",
"nativescript-telerik-ui": "^1.1.1",
"tns-core-modules": "^2.0.0"
},
"devDependencies": {
"babel-traverse": "6.9.0",
"babel-types": "6.10.2",
"babylon": "6.8.1",
"filewalker": "0.1.2",
"lazy": "1.0.11",
"nativescript-dev-typescript": "^0.3.2",
"typescript": "^1.8.10"
}
}
My NativeScript CLI version is 2.0.1
Any idea, what's probably going wrong ?
-------It's fixed-------
The solution is, after getting the error..
Don't remove the plugin
Remove the platform(android/ios)
Add the platform once again(android/ios)
Rebuild the app
Try
platform remove android
and then
platform add android
tns run android
I have had this issue every time I try to add a new plugin to nativescript (e.g the phone, telerik-UI, and contact plugins). What worked for me was just navigating into platform > android and then running gradlew clean. This way you wouldn't have to re-add the android platform every time you add a plugin.
This is also currently biting my project, which uses gulp-sass. gulp-sass depends on node-sass#^3.4.1 which just automatically updated to 3.5.3 which is a breaking release.
I have degraded my gulp sass version to the older(2.1.0) by updating the
package.json file but its still breaking.
how to go back to node sass 3.4.2?
Error Message
Error: You may not #extend an outer selector from within #media.
You may only #extend selectors within the same directive.
{
"version": "1.0.0",
"name": "abcd",
"devDependencies": {
"bower": "^1.3.12",
"express": "^4.12.3",
"gulp": "^3.8.10",
"gulp-autoprefixer": "^2.1.0",
"gulp-bower": "^0.0.7",
"gulp-concat": "^2.5.2",
"gulp-install": "^0.4.0",
"gulp-livereload": "^3.8.0",
"gulp-minify-css": "^1.0.0",
"gulp-plumber": "^1.0.0",
"gulp-sass": "2.1.0",
"gulp-sourcemaps": "^1.5.1",
"gulp-uglify": "^1.1.0"
},
"dependencies": {
"jquery": "1.11.1"
}
}
Looks like a new version was just released that allows the "buggy" version of node-sass but you can always npm shrinkwrap specific sub-dependencies to a specific version if you need to - assuming that the primary package is compatible with that dependency version.
This will lock the node-sass version in gulp-sass to 3.4.2:
{
"name": "yourprojectname",
"version": "1.0.0",
"dependencies": {
"gulp-sass": {
"version": "2.3.1",
"from": "gulp-sass#>=2.3.1 <3.0.0",
"resolved": "https://registry.npmjs.org/gulp-sass/-/gulp-sass-2.3.1.tgz",
"dependencies": {
"node-sass": {
"version": "3.4.2"
}
}
}
}
}
Make sure you delete your node_modules npm cache clean to clear your locally cached packages before running npm install again.