Native Script Angular code share project does not create node module directory and cannot create components

833 Views Asked by At

I have been trying to create an Angular code sharing project with Native Script. Here is my current system specs:

nativescript -version

6.8.0-rc.4

Angular CLI: 10.0.2

Node: 10.22.0

OS: darwin x6

@nativescript/[email protected]

When I run tns doctor:

Jasons-MacBook-Pro:Desktop owner$ tns doctor

✔ Getting environment information 



No issues were detected.

✔ Your ANDROID_HOME environment variable is set and points to correct directory.

✔ Your adb from the Android SDK is correctly installed.

✔ The Android SDK is installed.

✔ A compatible Android SDK for compilation is found.

✔ Javac is installed and is configured properly.

✔ The Java Development Kit (JDK) is installed and is configured properly.

✔ Xcode is installed and is configured properly.

✔ xcodeproj is installed and is configured properly.

✔ CocoaPods are installed.

✔ CocoaPods update is not required.

✔ CocoaPods are configured properly.

✔ Your current CocoaPods version is newer than 1.0.0.

✔ Python installed and configured correctly.

✔ The Python 'six' package is found.

✔ Xcode version 12.0.0 satisfies minimum required version 10.

✔ Getting NativeScript components versions information...

⚠ Update available for component nativescript. Your current version is 6.8.0-rc.4 and the latest available version is 6.8.0.

To initialize the project I run the following command:

ng new --collection=@nativescript/schematics project-name --shared

The project successfully creates but the console comes back with this:

⠴ Installing packages...npm WARN deprecated [email protected]: core-js@<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js@3.

npm WARN deprecated [email protected]: request has been deprecated, see https://github.com/request/request/issues/3142

npm WARN deprecated [email protected]: request has been deprecated, see https://github.com/request/request/issues/3142

npm WARN deprecated [email protected]: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.

npm WARN deprecated [email protected]: Please see https://github.com/lydell/urix#deprecated

npm WARN deprecated [email protected]: this library is no longer supported

npm WARN deprecated [email protected]: fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2.

npm WARN deprecated [email protected]: https://github.com/lydell/resolve-url#deprecated

npm ERR! code ETARGET

npm ERR! notarget No matching version found for @angular/http@~9.1.0.

npm ERR! notarget In most cases you or one of your dependencies are requesting

npm ERR! notarget a package version that doesn't exist.

npm ERR! notarget 

npm ERR! notarget It was specified as a dependency of 'project-name'

npm ERR! notarget 



npm ERR! A complete log of this run can be found in:

npm ERR!     /Users/owner/.npm/_logs/2020-08-02T02_31_24_911Z-debug.log

✖ Package install failed, see above.

The Schematic workflow failed. See above.

Owners-MacBook-Pro:Desktop owner$ 

In the docs I see this note: NOTE: If the above command doesn't work, check that you don't have an invalid configuration file in your home directory (/home/user-name/.angular.json). Please delete the file and run the command again.

But I'm not sure if this applies to my case and if it does, I'm not sure where to find this file. If the project did not create, is this file on my system somewhere?

Note: when running this command, projects never come with a 'node modules' folder. This makes sense because when I run 'ng g c [component-name] ' i get the following error:

An unhandled exception occurred: Cannot find module '@schematics/angular/utility/parse-name' 

I also get this error when there is a 'node modules' folder and there is a @schematics/angular/utility/parse-name (ts and d.ts) present.

I have referred to and tried a host of online threads to rectify this and frankly have wound the Native Script part of my brain in a ball of yarn.

Resources I have referenced and tried:

https://docs.nativescript.org/angular/code-sharing/creating-a-new-project
https://github.com/NativeScript/nativescript-schematics/pull/286
https://github.com/NativeScript/nativescript-schematics/issues/241

Thank you in advance for your help. I really appreciate it!

1

There are 1 best solutions below

0
On

This worked for me.

npm i --save-dev @nativescript/schematics