How can I install parcel package using npm install --save-dev parcel? - node.js

I am trying to install parcel webpack but there are some warnings in this installation. I also checked by deleting node_moduels folder but every time getting the same warning.
Screenshot 1
Screenshot 2

The command you are attempting to run uses Python 2 syntax. It is incompatible with Python 3 and when you want to install the package, node-gyp is executed with python3 and this error happened.
This question explain how to change the python version for install package

Related

npm install doesn't work because of node-sass on ubuntu

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.

Typescript is not removed even after reinstalling node

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%

Facing issue while installing tensorflow.js via npm

Used the following cmd (as given in the tensorflow docs) : npm install -g #tensorflow/tfjs-node
Tried to figure out the issue, but unable to find a solution. Kindly help in resolving this. (Thanks in Advance)
The image below shows the error I am getting.
You need to either install node-gyp (https://github.com/nodejs/node-gyp#installation) or ensure that the right version of python is accessible to it.
If you've already got node-gyp and python 2.7 installed, run npm config set python python2.7 to configure npm to use it.

Terminal command '--version' is showing an earlier version than what I just installed

I've been having serious issues with npm updating packages. I've changed the dependencies in my package.json's and ran npm install, I've tried deleting the global package but afterwards, when I type --version, my Command Line prints the version I just "deleted"), and I've tried installing over my current version. My command line looks like this:
I'd really love to avoid throwing my laptop through a window, but I'm getting close. Any ideas of why npm hates me?
The Firebase CLI comes from the npm package firebase-tools, not firebase. You should npm install -g firebase-tools#latest to get the latest CLI.

Angular CLI re-install Error during Angular Upgrade from 4.3 to 5

I was following steps to upgrade from Angular 4.3 to Angular 5. Here:
Migrating Angular 4.x to Angular 5
The angular update steps all went through smoothly.
The problem came after I uninstalled Angular CLI. And when trying to re-install, I get an unusual Python error that doesn't stop unless I force the task to stop.
If I run the install command npm install -g #angular/cli#latest 2 more times however. It finishes without error.
Running ng help works. But ng serve results in the following error:
I actually have the Python at that exact location. C:\Python27\python.exe
And I used to be running Angular CLI without a problem. So the python exe didn't cause an issue before I uninstalled it.
Also I tried searching for this "watchpack" error, and manually installed webpack again. That didn't solve my error.
I tried uninstalling Angular CLI at global/local. And re-install at the global level again, this python error consistently show up. And it's one of those infinite loop errors that does not stop without manual intervention.
Most Python errors I have seen from Angular CLI git-hub is an error/warning that ends.
node v6.10.2
npm 5.0.4
I think you need to install the windows build tools which now contain the python you are missing :
npm install --global --production windows-build-tools
https://github.com/felixrieseberg/windows-build-tools/issues/56

Resources