How to create Angular 9 project with IVY? - project

How to create Angular 9 project with IVY?
I tried the following:
ng new sample9prjivy --enable-ivy
My environment:
Angular CLI: 9.0.2
Node: 12.16.0
OS: win32 x64
Angular:
...
Ivy Workspace:
Package and Version
#angular-devkit/architect 0.900.2
#angular-devkit/core 9.0.2
#angular-devkit/schematics 9.0.2
#schematics/angular 9.0.2
#schematics/update 0.900.2
rxjs 6.5.3
C:\src\Angular\pilot\A9>ng new sample9prjivy --enable-ivy
Unknown option: '--enable-ivy'
What I missed?

As an earlier poster tried to explain, there's no such "ng new" flag as --enable-ivy.
As andrewjames explained above, the "ivy" tag is incorrect. You want "angular-ivy". I fixed it for you.
If you want to enable Ivy for older Angular builds, read this thread: How do I enable Ivy for Angular 8 or 9?. You'll need to edit tsconfig.json and angular.json.
It looks like Ivy is now the default for Angular 9:
https://angular.io/guide/ivy
Ivy is the code name for Angular's next-generation compilation and
rendering
pipeline.
With the version 9 release of Angular, the new compiler and runtime
instructions are used by default instead of the older compiler and
runtime, known as View Engine.
As the documentation discusses, there IS a flag for enableIvy ... but it's set in tsconfig.app.json. It is NOT a command line option for "ng new".
Update:
The answer to the OP's original question: you don't have to "create an Angular 9 project with Ivy": in Angular 9, Ivy should be enabled by default.
To answer the follow-on question about NG6002: look here (already cited below):
https://github.com/angular/angular/issues/35399
https://github.com/angular/angular/pull/35191
One final suggestion: it couldn't hurt to:
Update Angular: ng update #angular/cli #angular/core
Create a brand new project and copy the old source into the new project
Another Update
Original problem: ng new sample9prjivy --enable-ivy =>
Unknown option: '--enable-ivy'
Cause: --enable-ivy simply isn't a legal "ng" option with Angular 9. Don't do it!
Next problem: I always got more error NG6002
This is a well-known issue upgrading existing projects to Angular 9. Look here and here. The basic issue is that "upgrading" the project can result in "inconsistencies". Both links suggest workarounds; I've also suggested some workarounds. I don't know if you've tried any of them yet :(
CURRENT SUGGESTION:
Since you don't seem to be making much progress, I'd suggest the following:
a) UNINSTALL Angular: get a "clean version":
npm uninstall -g #angular/cli
npm cache clean
npm cache verify
npm install -g #angular/cli
b) Confirm your "clean install" of Angular 9:
ng --version
...
Angular CLI: 9.0.3
Node: 10.15.1
OS: win32 x64
Angular:
...
Ivy Workspace:
Package Version
------------------------------------------------------
#angular-devkit/architect 0.900.3
#angular-devkit/core 9.0.3
#angular-devkit/schematics 9.0.3
#schematics/angular 9.0.3
#schematics/update 0.900.3
rxjs 6.5.3
c) Create a brand new project with your "known good" Angular install.
Do NOT change ANY configuration! Do NOT try to explicitly "enable Ivy"!
d) Copy over your old source code (ONLY the project source code!) to your new project.
e) Verify that "everything works".
f) Post back what you find.

Related

Why angular.json is removed from Angular 14?

I have created a new angular project with the ng new command.
Angular CLI: 14.2.0
Node: 16.14.0
Package Manager: npm 8.3.1
OS: darwin arm64
Angular: 14.1.3
It has created a project which includes angular.json and the commands ng serve, and ng build were working. I just learned that angular.json is no longer used it was managed by angular CLI in the latest angular 14 versions. So, I tried to delete angular.json from my root project. But now the ng commands were not working.
The ng serve command gives the error: This command is unavailable when running the Angular CLI outside a workspace.
What does it mean? How can I fix this issue? Is it necessary to keep angular.json for workspace configuration? How can I serve my project without angular.json?

Sass does not yet support your current environment: Windows 64-bit with Unsupported runtime (93)

this what VSC terminal show me
Error: Node Sass does not yet support your current environment: Windows 64-bit with Unsupported runtime (93)
For more information on which environments are supported please see:
https://github.com/sass/node-sass/releases/tag/v4.14.1
i tried some solutions in stack overflow:
npm rebuild node-sass
and
npm uninstall node-sass && npm install node-sass
but does't work with , i saw some people talk about node version if support sass or not,
im using v16.14.0 it's LTS version should that support i guess,
i hope someone can help and THANK YOU
It's almost like it's trying to install the 4.x branch which only supports up to Node 14.
Try installing the 7.0.1 (current latest).
npm i node-sass#7.0.1
I'd recommend going ahead and wiping node_modules prior to installing just to be safe.
If that doesn't work, can you please post the entire output in the comment?
Fix the errors due to node-sass:
1. Remove "sass" and "sass-loader" from package.json
2. rm -rf node_modules
3. npm install
4. npm install sass --save-dev
5. npm install sass-loader --save-dev
The versions of some packages is enforced in package.json. The solution is to re-add them by letting npm to establish their right version for your OS.
I fixed this issue by forcing Visual Studio to use the node version I installed instead of VS installed version of node:
Go to Visual Studio, Tools -> Options, Project and Solutions -> Web Package Management -> External Web Tools, and move the $(PATH) to the second place below .\node_modules\.bin and above $(VSInstalledExternalTools). Restart Visual Studio.
Found this solution here.

Could Not Find statisfactory version from options when trying to install fishtown-analytics/codegen

I'm upgrading my dbt version from 0.16.0 to 0.17.2, and trying to update our codegen package as well.
My packages YML looks like this:
packages:
- package: fishtown-analytics/codegen
version: 0.2.0
The error I receive is this:
$ dbt deps
Running with dbt=0.17.2
Encountered an error:
Version error for package fishtown-analytics/codegen: Could not find a satisfactory version from options: ['=0.2.0', '=0.0.4', '=0.0.4']
Any Ideas?
I Also had some local packages within the packages.yml file which were dependent on a bad version of fishtown-analytics/codegen. After, I fixed all the dependencies in the downstream packages files everything imported correctly.

Gulp version 4. Why is it not the 'latest' version?

I am working on a project which has gulp as a dependency. I am looking at updating it to gulp 4. A quick look at the output of npm show gulp#latest shows
...
dist-tags:
latest: 3.9.1 next: 4.0.0
...
I wonder why the gulp team have left latest: 3.9.1 and choose next: 4.0.0, i.e. npm install gulp installs 3.9.1 while to get 4.0.0 one has to ask for npm install gulp#next. Why is the default version still 3.9.1? Is version 4.0.0 still not fully supported or something? I have not found anything regarding this on the gulp website.
From the npm dist-tag docs:
By default, the latest tag is used by npm to identify the current
version of a package, and npm install (without any # or
# specifier) installs the latest tag. Typically, projects only
use the latest tag for stable release versions, and use other tags for
unstable versions such as prereleases.
The next tag is used by some projects to identify the upcoming
version.
By default, other than latest, no tag has any special significance to
npm itself.
In this case latest is 3.x.x and next is 4.x.x As it is following semver, it means that there are backwards incompatible changes. If you check gulpjs.com, the link to the documentation brings you to the 3.x.x docs. It's the authorative version at the moment as set by the gulp maintainers.

Apache Cordova VS Community 2015 - Run Dependency Checker Fails

Apache Cordova Dependency Checker fails in VS Community 2015. It was previously working on this computer until I ran several VS and 3rd party tools updates. Here's what I've done to try to resolve the issue:
Installed VS / Apache Cordova (no error messages displayed) following article https://taco.visualstudio.com/en-us/docs/install-vs-tools-apache-cordova/
Run Apache Cordova Dependency Checker but VS freezes with the error message - VS 2015 has stopped working, windows will try to restart the program.
I restarted VS and cleared Cordova cache, checked environment variables (all good), then tried Apache Cordova Dependency Checker with the same freeze result.
I tried to update Apache Cordova with the fix option (no error messages) but received the same freeze results.
I completely uninstalled Apache Cordova, 3rd party tools (following article https://support.microsoft.com/en-us/kb/3016536), and VS community and then reinstalled them (no error messages) but received the same freeze results.
I installed Apache Cordova on another computer and the dependency checker phonegap app... worked. Unfortunately that's not a computer that I have access to.
What else can I do to resolve the Apache Cordova installation issue?
Thanks for any help,
Mike
Since my original post, I've had to resolve Visual Studio, Ionic, Cordova, Phonegap, plugin... environment issue several times. I've found the below works best:
Ensure platform matches plugin requirements, see platform in config.xml e.g. 6.1.1
Uninstall, reinstall latest jdk (adobe)
Clear MEF Cache - download the tool and follow instructions
Download/install latest node.js
Run the following from the command line:
Clear cache: Npm cache clean
Install latest npm: npm install -g npm
Uninstall cordova: Npm uninstall -g cordova
Reinstall cordova: Npm install –g cordova (note, this took 5+ tries to complete without errors. No other changes were made between runs. Not sure
why. Found others complaining about the same issue.)
Remove Android platform: Cordova platform remove android
Install Cordova platform add android#6.X.X (Note, as of 4/20/17 cordova and android compatibility issue. Build error - unable to find installed version of gradle. resolved by running (npm install -g cordova#6.4.0) and (cordova platform add android#6.1.2). Addt'l build errors, resolved by updating components in Android SDK Manager)
Uninstall/Reinstall plugins from the command line. For example:
cordova plugin remove phonegap-plugin-push
cordova plugin add phonegap-plugin-push variable SENDER_ID="YourID#"
npm install bower -g
Restart Visual Studio - Verify plugins were installed via config.xml
Install Ionic:
npm uninstall -g ionic
npm install -g ionic (note: to install specific version, npm install -g ionic#2.2.3)
$ ionic platform add ios
$ ionic platform add android (note: redundant, already added above)
I recommend putting as much of this as possible in a batch file with a pause between commands. Verify each command was successful, if not press ctrl+break at the pause to term the batch file early. The batch file is an easy way to restore your environment when everything breaks again. Stuff happens!
I also started using a VM (oracle virtualbox) for my development environment. That way I can backup my environment before making changes and easily restore. Don't forget to upload to GIT on a daily basis. GIT and VMs are my lifesavers.
Cool NPM commands:
npm list (lists all installed packages)
npm prune (removes packages not depended on by your project according to your package.json)
npm outdated (tells you which installed packages are outdated with respect to what is current in the npm registry but allowable by the version definition in your package.json. Make sure all up-to-date)
Please feel free to add/make suggestions to the above list.
-Mike