Typescript current version is 1.6.2, but when I am installing typescript and checking the version through "tsc -v" it gives me typescript version 1.0.3.0, due to which I am not being able to compile typescript.
Kindly tell me what should I do now. Need some serious help regarding this.
This installs the latest typescript globally:
npm install -g typescript
Related
I'm trying to npm install a project on Ubuntu but I'm getting this error:
Node Sass does not yet support your current environment: Linux 64-bit with Unsupported runtime (93)
The solutions I found on Stack Overflow was to run npm rebuild node-sass, like in this thread:
Node Sass does not yet support your current environment: Linux 64-bit with false
When I first tried this solution I got this error:
npm - “Can't find Python executable ”python“, you can set the PYTHON env variable.”
and the solution I found for it was to install Python 2.7, from here:
Can't find Python executable "python"
Now when I run python --version I get: Python 2.7.18
So I removed the node_modules folder and the lock file, and run npm install again, but it didn't work, and now I'm getting a build error, which you can find in this gist:
https://gist.github.com/aimad-majdou/b99c5295b56fd5bc68492fa638d63018
I never had issues installing this project on Mac OS and Windows, but this is the first time I try to install it on Ubuntu.
How can I solve this?
There are two solutions for this.
1. Fix python install for npm
You can tell npm to use the correct version of python by running the following command:
npm config set python python2.7
Hopefully after this you can build node-sass.
However, I personally use another solution:
2. Stop using node-sass
There is a pure-javascript sass implementation on npm called sass. It is compatible with node-sass. Just replace node-sass with sass.
Of course, often you did not decide which sass module to use. Usually some framework like React decided to use binary modules like node-sass so you are forced to use it. Well, you can override it in your projcet.
Open your package.json file and edit the node-sass line in the dependencies to:
"dependencies": {
...
"node-sass": "npm:sass#^1.30.0",
...
}
This tells npm to install sass version 1.30.0 as node-sass. Since the sass from the sass module command is compatible with the sass command from node-sass you can now build your project without worrying about building sass. Of course you can use a more recent version of sass if you like.
I see from the gist, that you're running node version 16.x on your ubuntu. As can be seen here, it is probably a version incompatibility between node 16 and the version of node-sass you're trying to build. You should be using at least version 6.0.1 of node-sass for node 16 support.
when i run the following command, it shows 6.4.1.
npm run ng --version
but when i am running the following command, it is installing 8.1.0 and getting error. i do not understand how it is happening.
npm install -g #angular/cli
i tried the following commands. but it is not working
npm cache clean --force
npm install -g #angular/cli
Error Screen
My Requirement:
Angular 6
how can i resolve this?
You should the latest (12+) node when upgrading to angular 8. You can download it from here.
After upgrading node, the issues should go away.
For simple use cases and thanks to the work done in Angular 8, you can upgrade to the latest release using one command:
$ ng update #angular/cli #angular/core
After running this command, the lazy loaded routes will be automatically migrated to the new import syntax which is standard compliant and brings Angular close to the open web platform.
You also need to be aware of the following issues when upgrading your project:
Angular 8 makes use of the latest TypeScript 3.4, so even if the upgrade process completes with success you might have some syntax errors that may be due to the better type inference system used by the latest version which detects new potential typing issues but in the end this will improve your code quality and helps you avoid bugs in the future. You can see the new features of TypeScript 3.4 from the official docs.
You need to have Node.js 12+. Simply run node -v to verify your Node version. You can install the latest version from the official website
While working on Angular 5 project, I got the following error on compilation :
#angular/compiler-cli#5.2.11 requires typescript#'>=2.4.2 <2.7.0' but 2.7.2 was found instead.
Using this version can result in undefined behaviour and difficult to debug problems.
Please run the following command to install a compatible version of TypeScript.
npm install typescript#'>=2.4.2 <2.7.0'
To disable this warning run "ng set warnings.typescriptMismatch=false".
To fix this error did the following:
Deleted all node_module instances, and uninstalled node from control panel -> add/remove programs.
Reinstalled node
Checked in cmd:npm view typescript version
I received version as 3.2.2
npm uninstall -g typescript
npm cache verify
Still typescript is not removed from npm.
Can some one help me uninstall typescript completely? Been stuck on this for 2 days now.
It seems there is a small mistake in compiler log:
Please run the following command to install a compatible version of TypeScript.
npm install typescript#'>=2.4.2 <2.7.0'
should be
npm install typescript#">=2.4.2 <2.7.0"
Maybe there is a mismatch in your package json. Update the typescript version as suggested and update package.json
run:
npm install typescript#'>=2.4.2 <2.7.0' --save
Check following step:
You call #angular/compiler-cli in global or local(just one folder), you need install typescript same.
Install typescript match '>=2.4.2 <2.7.0', example : typescript#2.6.2, local or global with -g.
Try close your cmd, reopen it (if typescript install global, cmd don't know it change if you don't reopen).
Check your eviroment variable NODE_PATH, if it exist, go to that folder to remove module in that.
To check NODE_PATH, type in your cmd : echo %NODE_PATH%
I have trouble with installing dependencies in my project. Gulp-sass version is 2.0.4. When I try to install with npm install I'm getting error 404 with node-sass v3.13.1. There is no link for it. I've also tried to insert source file of node-sass v3.13.1 but it's not working. I know the trouble is with link, but is there any way to get around this?
Node-sass is a c++ bridge so particular versions are only supported for some versions of NodeJS. In this case, you are running a new version of Node, that older version node-sass doesn't support. Newer versions also provide better error messages for this.
I am using ngx-bootstrap 1.9.2 npm package, but when I try to compile, my project, angular throws following error:
ERROR in C:/xxx/xx/node_modules/ngx-bootstrap/datepicker/bs-datepicker.component.d.ts (46,15): Cannot find name 'Partial'.
ERROR in C:/xxx/xx/node_modules/ngx-bootstrap/datepicker/bs-daterangepicker.component.d.ts (45,15): Cannot find name 'Partial'.
As Partial was introduced in ts version 2.1, I tried upgrading typescript version from 2.0.0 to 2.5.2 nothing helped.
we use typescript 2.4.2, because it's mandatory for angular#5.
What can help:
check global version of typescript
check local version of TS (and clean install and clean build)
if you are using Visual Studio, it has addition TS version
(this link may help https://github.com/Microsoft/TypeScript/issues/5995 )
It was just cache issue, I just perform npm cache clean and performed clean install and my problem was solved.
By the way thanks all, for your comments and answers.
For me it worked after doing the following steps.
install the latest typescript version globally. use below command.
npm install -g typescript#latest
Clean the npm cache using
npm clean cache
Install the latest typescript locally.
npm install -g typescript#latest
And it worked for me. Hope it helps.