template-nativescript-nx icon indicating copy to clipboard operation
template-nativescript-nx copied to clipboard

Error creating app from template

Open shawndewet opened this issue 7 years ago • 6 comments

I get this error when I try creating an app from this template:

tns create my-nx-app --template https://github.com/NathanWalker/template-nativescript-nx Installing https://github.com/NathanWalker/template-nativescript-nx

  1. Preparing NativeScript for Nx.
  2. Cleaning up.
  3. NativeScript for Nx is finalizing...
  • [email protected] added 3 packages in 15.099s npm ERR! code ENOLOCAL npm ERR! Could not install from "....\node_modules@angular\animations" as it does not contain a package.json file.

Please advise what I am missing.

shawndewet avatar Jan 09 '18 13:01 shawndewet

Try installing @angular/animations in the Nx workspace

breningham avatar Jan 11 '18 10:01 breningham

Thanks @breningham - yes @shawndewet depending on your app needs, you may want to install some supporting packages into the root of the workspace, ie:

npm i @angular/animations @angular/http --save

After installing those at the root, you can simply navigate directly into the mobile app and run npm i again. (ie: cd apps/mobile && npm i)

NathanWalker avatar Jan 14 '18 01:01 NathanWalker

My problem is that after the "tns create" command I am executing fails with the message indicated above, the folder is empty....there is no package.json file into which the "npm i @angular/animations --save" can be installed and saved into. As the "tns create" command is executing, I can see the folder structure get populated with files...but then after the failure it all gets rolled back, and I am left with an empty folder again.

shawndewet avatar Jan 16 '18 05:01 shawndewet

Uhg I had a brain fart...I just realised that for this to work I need to be in the "apps" folder of an existing nx workspace!!! Sorry for wasting your time!

shawndewet avatar Jan 16 '18 06:01 shawndewet

Ok, now I am running the "tns create" command from within the "apps" folder of my workspace, and I am getting this error:

npm ERR! code ENOLOCAL npm ERR! Could not install from "....\node_modules@ngrx\effects" as it does not contain a package.json file.

Then from the root of the workspace, when I run "npm i @ngrx\effects --save", I get this:

npm ERR! code ENOLOCAL npm ERR! Could not install from "@ngrx\effects" as it does not contain a package.json file.

What am I doing wrong? (Might be worth mentioning that I am in a workspace that I migrated from an existing AngularCLI project as instructed here:

shawndewet avatar Jan 16 '18 06:01 shawndewet

I found a different issue that also produced the same issue that the OP reported: "Could not install from "......\node_modules@angular\animations" as it does not contain a package.json file."

I realized that in the nativeScript app's package.json file it was adding too many ..\ to the front of every file reference. By changing ..\..\..\ to ..\..\ I got it to function correctly.

erik-slack avatar Oct 13 '19 18:10 erik-slack