python is not a valid npm option - npm

I am trying to set an older version of python in order to install modules and build an old node project.
I run this command:
npm config set python=python2.7
OR
npm config set python C:\Python27\python.exe
In both cases I am getting this error:
npm ERR! `python` is not a valid npm option
Nove v16.14.2
Npm v9.1.2

Consider downgrading npm to v8 for now:
npm install -g npm#^8
Alternatively, just run:
npm config edit
and add:
python=C:\Python27\python.exe
in a new line.

Related

npm ERR! code ENOLOCAL while running npm install

I am facing the error below, I tried clear the cache and install npm latest but all are no use to me, may I know is there any way to resolve it?
> npm install
npm ERR! code ENOLOCAL
npm ERR! Could not install from "node_modules\tui-editor\squire-rte#github:seonim-ryu\Squire#fd40b4e3020845825701e9689f190bab3f4775d4" as it does not contain a package.json file.
you should try to delete node modules folder repeatedly and reinstall packages by npm install command
npm cache clean try this command after deleted node modules

npm install gives '.' is not recognized as an internal or external command, operable program or batch file. error

I'm trying to run an existing project, but I'm stuck at install phase.
npm install gives me the following error:
npm ERR! path C:\Users\~\Source\node_modules\firebase\node_modules\grpc
npm ERR! command failed
npm ERR! command C:\WINDOWS\system32\cmd.exe /d /s /c ./node_modules/.bin/node-pre-gyp install --fallback-to-build --library=static_library
npm ERR! '.' is not recognized as an internal or external command,
npm ERR! operable program or batch file.
What could be causing the problem?
I already tried the following commands/workarounds, but this gives me the same error:
npm install --build-from-source #grpc/grpc-js
npm install --build-from-resources
deleting package-lock.json
The problem is with incompatible versions of node and npm between global instalation and your project angular version. To repair it, first you have to download and install nvm from here. Then you type
nvm install v8.11.3 and
nvm use v8.11.3.
After that you have to downgrade npm by typing
npm i npm#6.3.0 -g.
Now you can install node modules by typing
npm i
But this is not over :) You can't run the project by ng serve, because your node and npm version is mismatched with global #angular/cli version. So you have to revert to newest node by typing
nvm use 14.15.1 (if 14.15.1 is your version of node)
What about npm? It won't upgrade via npm i npm#latest -g, you have to use this workaround. After that you may have to install angular globally once again by typing
npm install -g #angular/cli#latest
and if you did that all and prayed enough, maybe it will work...

Vue Js Installation

Tried installing vue js through
npm install -g #vue/cli.
My npm version is 6.14.4 and node version is 12.16.2
This is the error i am getting
npm WARN deprecated request#2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
npm ERR! Unexpected end of JSON input while parsing near '...nEaUD\r\n=F4TR\r\n---'
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Sudesh\AppData\Roaming\npm-cache\_logs\2020-04-16T01_32_53_989Z-debug.log
I tried looking into the repo. I didn't understand what is the solution for this problem.
Try npm cache clean --force and then run the npm install -g #vue/cli . I think this must solve your issue.
Try npm cache clean --force and then run the npm install -g #vue/cli I think this must solve your issue.
Basically, use the npm cache clean --force command in our terminal to delete all data from your cache folder after that run npm install -g #vue/cli. then run vue create myapp to create your vue CLI app
Step : 1 npm cache clean --force
Step : 2 npm install -g #vue/cli
clean npm cache: npm cache clean --force
if you are using mac or Linux try with sudo npm install -g #vue/cli
for windows npm install -g #vue/cli

Error while installing vue CLI: npm ERR! Unexpected end of JSON input while parsing near '...ulp-rename":"0.0.33",'

I had an older version of vue CLI and i want to upgrade to CLI 3, so first what I did is unistall the previous version:
npm uninstall vue-cli -g
Then tried to install:
npm install -g #vue/cli
I got the following error:
npm ERR! Unexpected end of JSON input while parsing near '...ulp-rename":"0.0.33",'
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\31089\AppData\Roaming\npm-cache\_logs\2020-02-02T11_48_31_187Z-debug.log
The complete log information can be found here
My node version: v12.14.0
My npm version: 6.13.4
And I tried
npm cache clean --force
but didn't work.
I figured out, if you run command prompt window as an administrator, then first do
npm cache clean --force
then can install successfully.

npm install -g yo command gives -> ERR! yo#1.1.0 postinstall: `node scripts/doctor.js`

I just tried to do a npm install but get this error about doctor,js at the end. Do I need to worry about it?
npm install -g yo
.
.
npm http 304 https://registry.npmjs.org/graceful-fs
npm http 200 https://registry.npmjs.org/fstream/-/fstream-0.1.25.tgz
/usr/local/bin/yo -> /usr/local/lib/node_modules/yo/cli.js
> yo#1.1.0 postinstall /usr/local/lib/node_modules/yo
> node scripts/doctor.js
npm WARN This failure might be due to the use of legacy binary "node"
npm WARN For further explanations, please read
/usr/share/doc/nodejs/README.Debian
npm ERR! yo#1.1.0 postinstall: `node scripts/doctor.js`
npm ERR! `sh "-c" "node scripts/doctor.js"` failed with 1
npm ERR!
npm ERR! Failed at the yo#1.1.0 postinstall script.
npm ERR! This is most likely a problem with the yo package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node scripts/doctor.js
npm ERR! You can get their info via:
npm ERR! npm owner ls yo
npm ERR! There is likely additional logging output above.
npm ERR! System Linux 3.11.0-12-generic
npm ERR! command "/usr/bin/nodejs" "/usr/bin/npm" "install" "-g" "yo"
npm ERR! cwd /etc/libvirt/qemu
npm ERR! node -v v0.10.15
npm ERR! npm -v 1.2.18
npm ERR! code ELIFECYCLE
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /etc/libvirt/qemu/npm-debug.log
npm ERR! not ok code 0
EDIT____________--
for some reason node -v outputs nothing in terminal
I have the latest node installed:
WebstormProjects # sudo apt-get install node
Reading package lists... Done
Building dependency tree
Reading state information... Done
node is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 143 not upgraded.
The solution at this link has worked for me:
http://plaidzooks.tumblr.com/post/36894116867/using-node-js-on-debian-ubuntu-systems
Ubuntu comes with a package that automatically creates a link so the command 'nodejs' can be invoked as 'node' only by creating a link.
sudo apt-get install nodejs-legacy
And that got Yeoman working.
Likewise I had this same problem (albeit on a Mac). I uninstalled and upgraded node to the latest version (v0.10.24) but without success.
The symlink fix did work for me, although with a slight tweak:
sudo ln -s /usr/local/bin/node /usr/bin/node
I believe this may be due to the way which node was installed on your system. Apparently, sometimes when installing Node via a package manager, the linked binary is nodejs, (thus nodejs _command_ is the command that works on your machine, not the much more common node _comamand_. You can either re-install Node (the latest version is now 0.10.24) from nodejs.org, or try this solution from this related issue:
For anyone wishing to still use their OS's package of node the simple solution for this is to determine where node is installed on your OS and then create a symbolic link.
For example I had the issue on ubuntu and the install directory is /usr/bin. To create the symlink you can run:
sudo ln -s /usr/bin/nodejs /usr/bin/node
in windows you can use the mklink command.. Be sure to open the command prompt as a administrator
You have to install nodejs in this way:
sudo apt-get install python-software-properties
sudo add-apt-repository ppa:chris-lea/node.js
sudo apt-get update
sudo apt-get install nodejs
I had this same error on a clean Ubuntu 13.10 install and no amount of sym linking (node > nodejs) or installing/uninstalling helped me.
I don't have a deep enough understanding of the node environment to troubleshoot it properly but I was able to install Yeoman globally by cloning the repo and removing the postinstall check from package.json.
If anyone else want's to try this solution:
Clone Yeoman..
cd ~
git clone https://github.com/yeoman/yo
Edit the package.json..
nano yo/package.json
.. to remove these lines..
"scripts": {
"test": "grunt",
"postinstall": "node ./scripts/doctor",
"postupdate": "node ./scripts/doctor"
},
Then, install it using npm..
cd yo
npm install -g
If you want to clean up you can remove the Yeoman repo..
cd ..
rm -R yo/
Obviously your mileage may vary but it's working fine for me so far.
I also noticed I was able to successfully run the doctor.js script independent of the installation process. No idea why it was failing so hard in the first place..
On Ubuntu 14.04, I tried both installing the legacy package (per Antonio's answer) and creating the symlink manually (per Stephen's answer). Neither worked. The Ubuntu package has version 0.10.25 of node.js, but Yeoman seems to require a newer version.
After installing the latest version of node.js from NodeSource (currently v6.9.1), I was able to install Yeoman using npm install -g yo .
To solve this problem you need to install the package nodejs-legacy.
sudo apt-get install nodejs-legacy