Share code between nativescript and angular


Anyone help me to share code between mobile and web. I am try to use the plugin Nativescript-angular seed but i did’t get exact reference for that and also i am not able to share the code …
Anyone refer any tutorial or documents for that ?


hi @NJKannur,
did you have a look at this article:


yes i go through this and also i attend the webinar on code sharing between mobile and web using angular-nativescript seed plugin…but i am not able to run the sample project succesfully…anyone refer any option for that ?


Try cloning this repo, and start from there


i already clone the repo…after cloning the repo i try to run the web application using “ng serve” and mobile application using tns run --device 1. this is the error i got ,

As a forewarning, we are moving the CLI npm package to "@angular/cli" with the next release,
which will only support Node 6.9 and greater. This package will be officially deprecated
shortly after.

To disable this warning use "ng set --global warnings.packageDeprecation=false".

You have to be inside an angular-cli project in order to use the serve command.

for run nativescript ,i got the following error ,

Error is: SASS compiler failed with exit code 1.

So can you explain the steps to do after clone the repo?


after cloning the repo,
you have to first run npm i

and which version of Node are you running?, please make sure you are using a newer version than node 6.9.

and for Error is: SASS compiler failed with exit code 1.
first check if node-sass is installed globally on your system (if not, npm i -g node-sass)
and then,
try running npm rebuild node-sass --force


i am using node version v8.9.1 and npm 5.5.1
and also i install sass but get the same error

gyp ERR! configure error
gyp ERR! stack Error: Can't find Python executable "python", you can set the PYTHON env variable.
gyp ERR! stack     at PythonFinder.failNoPython (C:\Users\angular-native-seed\nativescript\node_modules\node-gyp\lib\configure.js:483:19)
gyp ERR! stack     at PythonFinder.<anonymous> (C:\Users\angular-native-seed\nativescript\node_modules\node-gyp\lib\configure.js:508:16)
gyp ERR! stack     at C:\Users\angular-native-seed\nativescript\node_modules\graceful-fs\polyfills.js:284:29
gyp ERR! stack     at FSReqWrap.oncomplete (fs.js:152:21)
gyp ERR! System Windows_NT 10.0.15063
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\angular-native-seed\\nativescript\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
gyp ERR! cwd C:\Users\angular-native-seed\nativescript\node_modules\node-sass
gyp ERR! node -v v8.9.1
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok
Build failed with error code: 1


now the code is running on web but not in native script

Error is: SASS compiler failed with exit code 1.

how to solve this ?


It is complaining that it can’t find python compiler. There might be some .py files in there.
Try installing python 3.x


Now web is working,getting the browser window .But for mobile the error is ,

Unable to apply changes on device: 94c7dcf2. Error is: The package archive file is invalid..

how to solve this ?why it is happens ?