Cannot find module '#schematics/angular/utility/project' - javascript

If I do ionic generate component xxx
An unhandled exception occurred: Cannot find module '#schematics/angular/utility/project'
Require stack:
/Users/user/develop/myapp/node_modules/#ionic/angular-toolkit/schematics/component/index.js
/Users/user/develop/myapp/node_modules/#angular-devkit/schematics/tools/export-ref.js
/Users/user/develop/myapp/node_modules/#angular-devkit/schematics/tools/index.js
/Users/user/develop/myapp/node_modules/#angular/cli/utilities/json-schema.js
/Users/user/develop/myapp/node_modules/#angular/cli/models/command-runner.js
/Users/user/develop/myapp/node_modules/#angular/cli/lib/cli/index.js
/Users/user/develop/myapp/node_modules/#angular/cli/lib/init.js
/Users/user/develop/myapp/node_modules/#angular/cli/bin/ng
Ionic:
Ionic CLI : 6.10.1 (/usr/local/lib/node_modules/#ionic/cli)
Ionic Framework : #ionic/angular 5.2.3
#angular-devkit/build-angular : 0.1000.2
#angular-devkit/schematics : 10.0.2
#angular/cli : 10.0.2
#ionic/angular-toolkit : 2.2.0
Capacitor:
Capacitor CLI : 2.1.2
#capacitor/core : 2.1.2
Cordova:
Cordova CLI : 9.0.0 (cordova-lib#9.0.1)
Cordova Platforms : android 8.1.0
Cordova Plugins : cordova-plugin-ionic-keyboard 2.2.0, cordova-plugin-ionic-webview 4.2.1, (and 7 other plugins)
Utility:
cordova-res : not installed
native-run : not installed
System:
ios-sim : 8.0.2
NodeJS : v12.18.1 (/usr/local/bin/node)
npm : 6.14.6
OS : macOS Catalina
Xcode : Xcode 11.5 Build version 11E608c

Seems like it's an ionic incompatibility with angular 10+
THIS WORKED FOR ME
npm uninstall #schematics/angular
npm install #schematics/angular#9.1.0

You may first proceed with npm uninstall #schematics/angular and TERMINAL informs that "removed XX packages and audited XXXX packages" etc, then you may implement npm install #schematics/angular#9.1.0.
Accordingly, ng add ngx-bootstrap provides:
✅️ Added "bootstrap
✅️ Added "ngx-bootstrap

In my case it was to have this:
"#ionic/angular-toolkit": "^2.3.3"
instead of "^2.2.0"
My Angular: 10.1.4.
I found this out by creating fresh Ionic project after upgrading Ionic CLI to newest.

The problem is schematics module incompatibility.
Find out the version of the #schematics/angular
node_modules/#schematics/angular/package.json/#_from
Find out the version of #schematics/angular which used in the #ionic/angular-toolkit module.
node_modules/#ionic/angular-toolkit/package.json
// package.json
"dependencies": {
"#schematics/angular": "^11.2.4",
}
Make sure the versions are matching.
If the versions do not match, then install the matching version of #schematics/angular.
Have an awesome day!

can you please try to run ng add #angular/pwa#13?

Try the code below
npm install #angular-devkit/schematics #angular-devkit/core #schematics/angular

This worked for me.
npm i --save-dev #nativescript/schematics

In my case, after failing with all kind of suggestions.
I update npm: https://www.hostingadvice.com/how-to/update-node-js-latest-version/
Later on Angular: https://update.angular.io/?v=13.0-14.0
and Ionic: https://ionicframework.com/docs/intro/upgrading-to-ionic-6
It works!!

Related

npm not installed latest version of package even after using caret(^)

I have added a package(X) as follows in package.json file
package(X): "^5.0.0"
now the latest version of package(X) is 5.0.1. According to my understanding this should install 5.0.1 but it installs version 5.0.0 itself.
Now I have multiple angular projects which are using package(X) and each of them have the same setup. What surprises me is that it works absolutely fine i.e installs version 5.0.1 in some projects and does not in some projects
Here is the info about package(x)
npm library info
It does depend on other packages' dependencies.
If there is a package that requires X to be exactly 5.0.0, then it will install 5.0.0 as it will satisfy ^5.0.0.
If there isn't one, then it will install whichever latest that will satisfy ^5.0.0 which is 5.0.1 in this case.

ERROR in The target entry-point "#auth0/angular-jwt" has missing dependencies:

I have an angular project version:
#angular-devkit/architect 0.901.1
#angular-devkit/core 9.1.1
#angular-devkit/schematics 9.1.1
#schematics/angular 9.1.1
#schematics/update 0.901.1
rxjs 6.5.4
After executing:
#auth0/angular-jwt
I can not compile my project and it gives this error:
ERROR in The target entry-point "#auth0/angular-jwt" has missing dependencies:
- tslib
- #angular/core
- rxjs/operators
- rxjs
- #angular/common/http
I am very new at angular, please help me. I already executed these commands:
npm install --save "package names"
but they gave errors.
I had this same problem. As we are using the version of angular 9, we have to install version 4.2.0 of angular-jwt. According to their site:
https://www.npmjs.com/package/#auth0/angular-jwt
# auth0 / angular-jwt v5 is to be used with Angular v10 + and RxJS v6 +. For Angular v6 + to v9, use # auth0 / angular-jwt v4
So:
Uninstall #auth0 (npm uninstall #auth0/angular-jwt)
Deleted the package-LOCK.json folder
Ran the compatible installation #auth for angular 9 (npm install #auth0/angular-jwt#4.2.0)
Now when I ran the ng serve it ran normally.
I hope I helped you. ;)

Metadata version mismatch Angular 4 #ng-bootstrap

I am working on Angular bootstrap module. When I install the module using following commands npm install --save #ng-bootstrap/ng-bootstrap and import the module to the main app module. Then I rerun getting error for the following.
ERROR in Error: Metadata version mismatch for module F:/nodejs/angular4/mybootst
rap3/node_modules/#ng-bootstrap/ng-bootstrap/index.d.ts, found version 4, expect
ed 3, resolving symbol AppModule in F:/nodejs/angular4/mybootstrap3/src/app/app.
module.ts, resolving symbol AppModule in F:/nodejs/angular4/mybootstrap3/src/app
/app.module.ts
Here is my angular version
#angular/cli: 1.4.4
node: 6.11.2
os: win32 ia32
#angular/animations: 4.4.6
#angular/common: 4.4.6
#angular/compiler: 4.4.6
#angular/core: 4.4.6
#angular/forms: 4.4.6
#angular/http: 4.4.6
#angular/platform-browser: 4.4.6
#angular/platform-browser-dynamic: 4.4.6
#angular/router: 4.4.6
#angular/cli: 1.4.4
#angular/compiler-cli: 4.4.6
#angular/language-service: 4.4.6
typescript: 2.3.4
Question
Have to install angular latest version?.
If I install latest version can I run my Angular 4 project?
Why I'am getting this error?
The error is caused by the fact that ng-bootstrap module version that is installed has its metadata targeted for a higher version of Angular. To resolve this,
Find out which version of ng-bootstrap is currently installed by running
npm list ng-bootstrap
Run the following to see all the available versions of the ng-bootstrap node module.
npm show ng-bootstrap#* version
Pick one version lower than what is currently installed, and install it
npm install ng-bootstrap#x.y.z
*The x.y.z refers to version number.
Try npm start now, and see if it works.
If it doesn't, revert to one more lower version, and retry the above step of npm install.
Once it works - update package.json with the version number that resolved the issue so this issue doesn't appear again in the future. Let's say if version no. 1.3.0 solves the issue, then update the package json with.
"#ng-bootstrap/ng-bootstrap": "1.3.0"
Remove the caret (^) if it exists, to prevent auto-selecting the highest module version available.
This occurs because as of the latest version of #ng-bootstrap has issue.
I solved it by changing
"#ng-bootstrap/ng-bootstrap": "^1.0.0-beta.5",
in the package.json to
"#ng-bootstrap/ng-bootstrap": "1.0.0-beta.5",
You need specify the correct version in the package.json otherwise it will fetch the latest ng-bootstrap which has issue working with angular 4

ionic building TypeError: env.runcmd is not a function

During build of an ionic App, this error is shown:
anyone can help me ?
It says:
Error occurred during command execution from a CLI plugin
(#ionic/cli-plugin-cordova). Your plugins may be out of
date.
Did you try to install latest cordova plug-in :
$> npm install #ionic/cli-plugin-cordova#latest
Also update the dependencies....
Things to try:
run "cordova platform add ios" and "cordova platform add android"
run npm install --save --save-exact ionic#3.6.0 and then upgrade it to newest version
if it still does not work then just do downgrade without upgrade and wait until stable version will be released
In my case, I just change version package.json of this two plugins under devDependencies section. (In your case version number may differ)
"#ionic/cli-plugin-cordova" : "1.4.1",
"#ionic/cli-plugin-ionic-angular" : "1.3.2"
after this change in package.json run below command:
npm update
Now try to build, it's working.
The main problem for me was the #ionic/cli-plugin-cordova , so I downgraded it to v1.4.1 ( Don't know if any of the later versions are working fine.)
Command:
npm install --save-dev #ionic/cli-plugin-cordova#1.4.1
I my case what I did was went to the project folder and ran the following command to Get it working
cd platforms/ios/cordova && npm install ios-sim#latest

How can I set up Vue.js in my Laravel Project ?

I work with Laravel and I try to do something with Vue.js but I can't see it up.
First of all I install Node.js and npm.
Now I'm trying to user 'npm run watch'. To see if my js code runs on my laravel project.
But, when I type 'npm run watch' in my cmd. It's like this:
What should I do ?
Thanks !
It looks like your version of Laravel Mix is out-of-date; there was a bug fixed in March 2017 that addressed this issue on newer versions of webpack.
You can update your version of Laravel Mix by either doing this:
npm uninstall laravel-mix && npm install --save-dev laravel-mix
or updating your package.json file to change the version for laravel-mix
...
"devDependencies": {
...
"laravel-mix": "^0.11.4",
...
}
...
After changing the version number, run npm update.

Categories

Resources