I have just installed npm and ionic following the instructions on ionic framework website and as soon as i start a new project i get these errors - node.js

I'm new to Ionic Framework. I have just installed npm and ionic following the instructions on ionic framework website and as soon as i start a new project i get these errors.
Ionic Info
Ionic:
Ionic CLI : 6.12.4
Utility:
cordova-res : not installed
native-run : not installed
System:
NodeJS : v15.7.0
npm : 7.4.3
OS : macOS Big Sur
% ionic start
? Framework: Angular
? Project name: app
? Starter template: blank
✔ Preparing directory ./aps in 887.30μp
✔ Downloading and extracting blank starter in 143.10ms
? Integrate your new app with Capacitor to target native iOS and Android? No
Installing dependencies may take several minutes.
──────────────────────────────────────────────────────────────
Ionic Appflow, the mobile DevOps solution by Ionic
Continuously build, deploy, and ship apps 🚀
Focus on building apps while we automate the rest 🎁
👉 https://ion.link/appflow 👈
──────────────────────────────────────────────────────────────
> npm i
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: aps#0.0.1
npm ERR! Found: typescript#4.1.3
npm ERR! node_modules/typescript
npm ERR! peer typescript#">=4.0 <4.2" from #angular/compiler-cli#11.1.2
npm ERR! node_modules/#angular/compiler-cli
npm ERR! peer #angular/compiler-cli#"^11.0.0" from #angular-devkit/build-angular#0.1100.7
npm ERR! node_modules/#angular-devkit/build-angular
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer typescript#"~4.0.0" from #angular-devkit/build-angular#0.1100.7
npm ERR! node_modules/#angular-devkit/build-angular
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR!
npm ERR! See /Users/<username>/.npm/eresolve-report.txt for a full report.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/<username>/.npm/_logs/2021-02-04T03_19_54_834Z-debug.log
[ERROR] An error occurred while running subprocess npm.
npm i exited with exit code 1.
Re-running this command with the --verbose flag may provide more
information.

I ran into the same issue. After running ionic start I was able to run npm install --force from within the project folder and get #angular-devkit/build-angular#0.1100.7 to install. I believe this is a compatibility issue on angular's side. I did confirm I was able to serve the project locally. However, I would not consider this a permanent solution due to the possibility of conflicts with #angular-devkit/build-angular#0.1100.7 and the version of typescript you are currently running.

Related

npm ERESOLVE could not resolve #angular/elements#11.2.14 after trying to update to angular 12

I have a angular 11 application and i wanted to update it to the latest 14, based on the officiel website i had to go update one by one so 11 to 12, 12 to 13 and 13 to 14.
So i created a new branch on git and started [here][1] with ng update #angular/core#12 #angular/cli#12, i had a bunch of dependencies issues after so i rolled back on the master branch, but i still have problems with npm dependencies, everytime i do a npm install i have something like this that i don't understand at all :
npm i
npm WARN config global `--global`, `--local` are deprecated. Use `--location=global` instead.
npm ERR! code ERESOLVE
npm ERR! ERESOLVE could not resolve
npm ERR!
npm ERR! While resolving: #angular/elements#11.2.14
npm ERR! Found: #angular/core#11.0.9
npm ERR! node_modules/#angular/core
npm ERR! #angular/core#"~11.0.9" from the root project
npm ERR! peer #angular/core#"11.0.9" from #angular/animations#11.0.9
npm ERR! node_modules/#angular/animations
npm ERR! #angular/animations#"~11.0.9" from the root project
npm ERR! peer #angular/animations#"^11.0.0 || ^12.0.0-0" from #angular/material#11.0.3
npm ERR! node_modules/#angular/material
npm ERR! #angular/material#"^11.0.3" from the root project
npm ERR! 1 more (#angular/platform-browser)
npm ERR! 13 more (#angular/cdk, #angular/common, #angular/fire, ...)
I tried to do npm install --force and npm install --legacy-peer-deps, but still i can't just do npm install as i'm used to, is there something that breaks angular when doing the ng update.
for the versions that i use i have :
Angular CLI: 11.0.7
Node: 16.15.1
OS: win32 x64
Angular: 11.0.9
npm: 8.11.0
Do you think i need to reinstall angular? I don't get how the project can be broken when i rolled back to the branch before any modification on the project. I feel like the easiest way to update is to create a new project on the version you want and add everything back in it little by little.
if you have any idea on this i'll take it.
Thanks in advance !
[1]: https://update.angular.io/?l=3&v=11.0-12.0

Installing dependencies with npm-peer-dependencies

I am trying to install the required node_modules for a small project running Angular 11 using npm install
My goal is get the project to work locally after downloading it from GitHub. I have already installed the latest version of the Angular CLI.
After running the install command I tried npm start.
I was expecting that after running the install and start command to be able to run the project locally.
However the actual result I get after running the install command is the following list of errors:
> ng serve
An unhandled exception occurred: Cannot find module '#angular/compiler'
Require stack:
\node_modules\#angular\compiler-cli\index.js
\node_modules\#ngtools\webpack\src\angular_compiler_plugin.js
\node_modules\#ngtools\webpack\src\index.js
\node_modules\#angular-devkit\build-angular\src\webpack\configs\typescript.js
\node_modules\#angular-devkit\build-angular\src\webpack\configs\index.js
\node_modules\#angular-devkit\build-angular\src\browser\index.js
\node_modules\#angular-devkit\build-angular\src\dev-server\index.js
\node_modules\#angular-devkit\architect\node\node-modules-architect-host.js
\node_modules\#angular-devkit\architect\node\index.js
\node_modules\#angular\cli\models\architect-command.js
\node_modules\#angular\cli\commands\serve-impl.js
\node_modules\#angular-devkit\schematics\tools\export-ref.js
\node_modules\#angular-devkit\schematics\tools\index.js
\node_modules\#angular\cli\utilities\json-schema.js
\node_modules\#angular\cli\models\command-runner.js
\node_modules\#angular\cli\lib\cli\index.js
\node_modules\#angular\cli\lib\init.js
\node_modules\#angular\cli\bin\ng
See "angular-errors.log" for further details.
npm ERR! code ELIFECYCLE
npm ERR! syscall spawn
npm ERR! file C:\WINDOWS\system32\cmd.exe
npm ERR! errno ENOENT
npm ERR! `ng serve`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the #0.0.16 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
The problem is that this Angular project also has peer dependencies. I installed npm-install-peers package but it seems that simply running npm install afterwards will not install the required peer dependencies.
What should I do next to get this Angular project installed locally ?
The issue you are facing is likely because angular cli or npm-peer-dependencies are not installed globally on your machine.
The steps that you should take are to make sure of them are globally installed.
To install packages globally you need run npm install -g <package_name>
npm docs link
In your case for angular cli you should run
npm i -g #angular/cli#11.2.15 and npm install -g npm-peer-dependencies.
Then run npm start.

Issue when I try to execute npm install

when I run the command npm install, it displays this error:
[log#server:www]$ npm install
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: undefined#undefined
npm ERR! Found: vue#2.6.14
npm ERR! node_modules/vue
npm ERR! dev vue#"^2.5.17" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer vue#"^3.0.0" from vee-validate#4.4.4
npm ERR! node_modules/vee-validate
npm ERR! vee-validate#"^4.2.3" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR!
npm ERR! See /root/.npm/eresolve-report.txt for a full report.
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2021-06-09T01_39_40_386Z-debug.log
I wonder, how can I fix it? What does it mean?
Thanks
It looks like you're trying to install vee-validate version 4.0 in a Vue 2.x application. You can see the compatible version in the vee-validate repo.
How to fix:
Option 1:
Install an older version of Vee-validate (v2 or v3).
First, you'll need to uninstall the version you currently have installed (I'm assuming you installed vee-validate#next since that's the doc recommendation)
npm uninstall vee-validate#next
You can then find the list of versions available with
npm info vee-validate versions
Finally, install an older version with
npm install vee-validate#3.4.9
Replace the 3.4.9 with whatever version you would like to install - as of the time of writing, 3.4.9 is the latest stable tag
Option 2:
Upgrade from Vue 2 to Vue 3 following the upgrade guide.
Note that this is still a work in progress and may have some stability issues and depending on the state of the project I would consider using the above option for the time being.
Step:-1 Make sure node.js is installed on your system. You can check with the command npm --version or node --version
Step:-2 Clear npm cache. run this command npm cache clear -f
Step:-3 Then try to run npm install

Can't start react native project with npm start

First i started with installing npm (version ) then expo cli (version ) then i initialise a project normaly then when i start my project with npm start and also expo start a get this message :
Cannot determine which native SDK version your project uses because the module `expo` is not installed. Please install it with `yarn add expo` and try again.
ConfigError: Cannot determine which native SDK version your project uses because the module `expo` is not installed. Please install it with `yarn add expo` and try again.
at Object.getExpoSDKVersion (C:\Users\BILAL\AppData\Roaming\npm\node_modules\expo-cli\node_modules\#expo\config\src\Project.ts:22:9)
at ensureConfigHasDefaultValues (C:\Users\BILAL\AppData\Roaming\npm\node_modules\expo-cli\node_modules\#expo\config\src\Config.ts:419:22)
at fillAndReturnConfig (C:\Users\BILAL\AppData\Roaming\npm\node_modules\expo-cli\node_modules\#expo\config\src\Config.ts:101:10)
at getConfig (C:\Users\BILAL\AppData\Roaming\npm\node_modules\expo-cli\node_modules\#expo\config\src\Config.ts:137:10)
at configureProjectAsync (C:\Users\BILAL\AppData\Roaming\npm\node_modules\expo-cli\src\commands\start.ts:288:25)
at action (C:\Users\BILAL\AppData\Roaming\npm\node_modules\expo-cli\src\commands\start.ts:164:34)
at C:\Users\BILAL\AppData\Roaming\npm\node_modules\expo-cli\src\commands\start.ts:341:16
at Command.<anonymous> (C:\Users\BILAL\AppData\Roaming\npm\node_modules\expo-cli\src\exp.ts:82:7)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! # start: expo start
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the # start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\BILAL\AppData\Roaming\npm-cache_logs\2020-05-17T00_34_22_028Z-debug.log
also i worked with react native and react-cli before for a simple app and it worked but this time i tried for a week without result
thank you so much

Expo project not starting

My expo project doesn't start when I try to use npm start.
Versions that I am using are
Expo-cli: 3.20.5
Node : 12.16.3
Flow:
expo init project
-> blank template
expo start
After running the expo start command it gives the following error
Cannot determine which native SDK version your project uses because the module `expo` is not installed. Please install it with `yarn add expo` and try again.
ConfigError: Cannot determine which native SDK version your project uses because the module `expo` is not installed. Please install it with `yarn add expo` and try again.
at Object.getExpoSDKVersion (C:\Users\Talha\AppData\Roaming\npm\node_modules\expo-cli\node_modules\#expo\config\src\Project.ts:35:9)
at ensureConfigHasDefaultValues (C:\Users\Talha\AppData\Roaming\npm\node_modules\expo-cli\node_modules\#expo\config\src\Config.ts:419:22)
at fillAndReturnConfig (C:\Users\Talha\AppData\Roaming\npm\node_modules\expo-cli\node_modules\#expo\config\src\Config.ts:101:10)
at configureProjectAsync (C:\Users\Talha\AppData\Roaming\npm\node_modules\expo-cli\src\commands\start.ts:281:25)
at action (C:\Users\Talha\AppData\Roaming\npm\node_modules\expo-cli\src\commands\start.ts:157:34)
at C:\Users\Talha\AppData\Roaming\npm\node_modules\expo-cli\src\commands\start.ts:334:16
at Command.<anonymous> (C:\Users\Talha\AppData\Roaming\npm\node_modules\expo-cli\src\exp.ts:85:7)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! # start: `expo start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the # start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm WARN Local package.json exists, but node_modules missing, did you mean to install?
Then as mentioned in the above first line I ran npm install expo
After running the command for installing expo it gives me the following error
Error: React Native is not installed. Please run `npm install` in your project directory.
Couldn't start project. Please fix the errors and restart the project.
at startExpoServerAsync (C:\#expo\xdl#57.9.5\src\Project.ts:2080:11)
at Object.startAsync (C:\#expo\xdl#57.9.5\src\Project.ts:2397:5)
at action (C:\Users\Talha\AppData\Roaming\npm\node_modules\expo-cli\src\commands\start.ts:170:3)
at C:\Users\Talha\AppData\Roaming\npm\node_modules\expo-cli\src\commands\start.ts:341:16
at Command.<anonymous> (C:\Users\Talha\AppData\Roaming\npm\node_modules\expo-cli\src\exp.ts:85:7)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! # start: `expo start`
npm ERR! Exit status 1
npm ERR! Failed at the # start script.
Then I ran npm install mentioned in the above error but then got this error
npm WARN deprecated deep-assign#3.0.0: Check out `lodash.merge` or `merge-options` instead.
npm WARN deprecated core-js#1.2.7: 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 ERR! code Z_BUF_ERROR
npm ERR! errno -5
npm ERR! zlib: unexpected end of file
after that when i again try to npm start it keeps repeating itself through the same errors I mentioned above
the problem is that npm install is not working on your machine, possibly due to some cache issues. you can run npm cache clean --force and then npm install again to try to resolve the issue
Illustration I had the same issue and cleaned up my node module. But the issue came back because I kill my server the wrong way. So I cleaned the repo again and close my server properly. And now I all the time close correctly my server. The issue didn't happen again for the moment.
=> Don't kill your cmd, you have to close the server correctly by doing CMD+C for win 10.

Resources