How to suppress deprecation warning from npm/nvm in zsh? - node.js

I am using nvm for managing node versions. I have installed it as a plugin to zsh via zsh-nvm. I have installed two versions of node - v6.1.0 and v.0.10.42. Since I am working on a project, which uses the latter one, I have set it at the default one. Now, every time I open a terminal window, I get these warnings:
npm WARN deprecated This version of npm lacks support for important features,
npm WARN deprecated such as scoped packages, offered by the primary npm
npm WARN deprecated registry. Consider upgrading to at least npm#2, if not the
npm WARN deprecated latest stable version. To upgrade to npm#2, run:
npm WARN deprecated
npm WARN deprecated npm -g install npm#latest-2
npm WARN deprecated
npm WARN deprecated To upgrade to the latest stable version, run:
npm WARN deprecated
npm WARN deprecated npm -g install npm#latest
npm WARN deprecated
npm WARN deprecated (Depending on how Node.js was installed on your system, you
npm WARN deprecated may need to prefix the preceding commands with `sudo`, or if
npm WARN deprecated on Windows, run them from an Administrator prompt.)
npm WARN deprecated
npm WARN deprecated If you're running the version of npm bundled with
npm WARN deprecated Node.js 0.10 LTS, be aware that the next version of 0.10 LTS
npm WARN deprecated will be bundled with a version of npm#2, which has some small
npm WARN deprecated backwards-incompatible changes made to `npm run-script` and
npm WARN deprecated semver behavior.
I tried adding a ~/.npmrc file, in which I put loglevel="error", but I still get these warnings. I guess I need to put some setting in my .zshrc file. Could you point me to which one?

As far as I'm aware, the only way to suppress these warnings (from npm) is to use a version of npm that doesn't emit them.

NODE_NO_WARNINGS=1 npm install ...

Related

"npm outdated" and "npm outdated -g" don't show anything so why am I getting these warnings of deprecations?

I have node.js version 12.16.3 (macOS x64), the most current LTS version. The npm version is 6.14.4, which comes as default with the node.js version already stated. My operating system is Catalina 10.15.4 (the latest version).
When I run npm outdated and npm outdated -g nothing is returned, I simply get a new line.
Yet when I run this inside of my project:
npm init followed by npm i --save-dev babel-cli babel-preset-env, I get these warnings:
npm WARN deprecated chokidar#1.7.0: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.
npm WARN deprecated core-js#2.6.11: 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 WARN deprecated fsevents#1.2.12: fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2.
npm WARN deprecated urix#0.1.0: Please see https://github.com/lydell/urix#deprecated
npm WARN deprecated resolve-url#0.2.1: https://github.com/lydell/resolve-url#deprecated
I have tried running npm install chokidar#^3 and I get the exact same warnings.
I have tried running npm install chokidar#latest and I get the exact same warnings.
I can't seem to update what I am being told to update. How can I resolve this issue?
Any help is much appreciated.

npm install Permission denied /.npm/_cacache/

When I use sudo npm install command get error.
usr6783#usr6783:~/albarakaMobil/client/mobile-branch$ sudo npm install
[sudo] password for usr6783:
npm WARN deprecated react-native-languages#1.0.7: This project has been renamed to react-native-localize. Install using react-native-localize instead.
npm WARN deprecated node-uuid#1.4.8: Use uuid module instead
npm WARN deprecated sw-precache#5.2.1: Please migrate to Workbox: https://developers.google.com/web/tools/workbox/guides/migrations/migrate-from-sw
npm WARN deprecated browserslist#2.11.3: Browserslist 2 could fail on reading Browserslist >3.0 config used in other tools.
npm WARN deprecated circular-json#0.3.3: CircularJSON is in maintenance only, flatted is its successor.
npm WARN deprecated sw-toolbox#3.6.0: Please migrate to Workbox: https://developers.google.com/web/tools/workbox/guides/migrations/migrate-from-sw
npm WARN deprecated core-js#1.2.7: core-js#<2.6.5 is no longer maintained. Please, upgrade to core-js#3 or at least to actual version of core-js#2.
npm WARN deprecated browserslist#1.7.7: Browserslist 2 could fail on reading Browserslist >3.0 config used in other tools.
npm WARN deprecated node-uuid#1.3.3: Use uuid module instead
npm WARN deprecated flatten#1.0.2: I wrote this module a very long time ago; you should use something else.
npm WARN deprecated socks#1.1.10: If using 2.x branch, please upgrade to at least 2.1.6 to avoid a serious bug with socket data flow and an import issue introduced in 2.1.0
npm ERR! code 1
npm ERR! Command failed: git clone --mirror -q git://github.com/rhdeck/react-native-fix-xcode-10.git /home/usr6783/.npm/_cacache/tmp/git-clone-aa7d6ae5/.git
npm ERR! /home/usr6783/.npm/_cacache/tmp/git-clone-aa7d6ae5/.git: Permission denied
npm ERR!
npm ERR! A complete log of this run can be found in:
npm ERR! /home/usr6783/.npm/_logs/2019-05-07T06_12_46_865Z-debug.log
use :
sudo npm cache clean -f
referred to this
I encountered a similar problem today, and npm suggested I should run
sudo chown -R 501:20 "~/.npm"
It says this is due to a bug in previous versions of npm and has since been addressed. You might want to update to npm version 7.10.0 or later, and run the command above.

Updating npm in Docker image

I am building a Node.js Docker image: docker build . -t imagename, however I keep getting warning regarding npm version
npm WARN deprecated This version of npm lacks support for important features,
npm WARN deprecated such as scoped packages, offered by the primary npm
npm WARN deprecated registry. Consider upgrading to at least npm#2, if not the
npm WARN deprecated latest stable version. To upgrade to npm#2, run:
npm WARN deprecated
npm WARN deprecated npm -g install npm#latest-2
npm WARN deprecated
npm WARN deprecated To upgrade to the latest stable version, run:
npm WARN deprecated
npm WARN deprecated npm -g install npm#latest
npm WARN deprecated
npm WARN deprecated (Depending on how Node.js was installed on your system, you
npm WARN deprecated may need to prefix the preceding commands with `sudo`, or if
npm WARN deprecated on Windows, run them from an Administrator prompt.)
npm WARN deprecated
npm WARN deprecated If you're running the version of npm bundled with
npm WARN deprecated Node.js 0.10 LTS, be aware that the next version of 0.10 LTS
npm WARN deprecated will be bundled with a version of npm#2, which has some small
npm WARN deprecated backwards-incompatible changes made to `npm run-script` and
npm WARN deprecated semver behavior.
However I have update Node.js version, and it still wouldn't work:
node -v
v8.9.3
npm -v
5.6.0
I have ran npm -g install npm#latest but still won't work.
Dockerfile
FROM alpine:3.1
# Update
RUN apk add --update nodejs
# Install app dependencies
COPY package.json /src/package.json
RUN cd /src; npm -g install npm#latest
# Bundle app source
COPY . /src
CMD ["node", "--harmony","/src/app.js"]
What could possibly be the cause? I am able to run the app using node just fine.
I'm running Ubuntu 16.04.3 LTS
In Dockerfile, I used latest alpine version FROM alpine:3.7 instead and it works.
You must run docker image pull node to download the latest node (npm included) image locally before building your image.
Hope that helps!

Install ember#1.13.13 on Windows 7 and it keeps hanging on the extract of bower

I'm trying to "npm install -g ember#1.13.13" on Windows 7 and it keeps hanging on the extract of bower. I've tried clearing the npm cache and the bower cache but it still hangs. I'm installing that specific version of ember as that is the version required for the project I'm involved with. Here is the command window output;
C:\Windows\System32>npm install -g ember-cli#1.13.13
npm WARN deprecated minimatch#2.0.10: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated graceful-fs#2.0.3: graceful-fs v3.0.0 and before will fail on node releases >= v7.0. Please update to graceful-fs#^4.0.0 as soon as possible. Use 'npm ls gracef
ul-fs' to find it in the tree.
npm WARN deprecated lodash-node#2.4.1: This package has been discontinued in favor of lodash#^4.0.0.
npm WARN deprecated lodash-node#3.10.2: This package has been discontinued in favor of lodash#^4.0.0.
npm WARN deprecated cross-spawn-async#2.2.4: cross-spawn no longer requires a build toolchain, use it instead!
npm WARN deprecated socket.io-pure#1.3.12: socket.io-pure is no longer maintained as the original socket.io removed all native dependencies. Please use the original.
npm WARN deprecated lodash#2.3.0: lodash#<3.0.0 is no longer maintained. Upgrade to lodash#^4.0.0.
npm WARN deprecated minimatch#0.2.14: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated engine.io-pure#1.5.9: engine.io-purce is no longer maintained as the original engine.io removed all native dependencies. Please use the original.
npm WARN deprecated socket.io-client-pure#1.3.12: socket.io-client-pure is no longer maintained as the original socket.io removed all native dependencies. Please use the original.
npm WARN deprecated ws-pure#0.8.0: ws-pure is no longer maintained as the original ws removed all native dependencies. Please use the original ws.
npm WARN deprecated engine.io-client-pure#1.5.9: engine-io-client-pure is no longer maintained as the original engine-io-client removed all native dependencies. Please use the orig
inal.
extract:bower ▌ ╢██████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████░░░░░░░░░░░░░░░░░░░░░░░░░░░╟
These are the installed versions of
node: v4.4.7
npm: 3.3.12
bower: 1.7.9

Error while installing generator-mean-seed

I am trying to follow the instructions given on https://www.npmjs.com/package/generator-mean-seed
When i try to run "sudo npm install -g generator-mean-seed" i get this error
npm install -g generator-mean-seed
npm WARN deprecated lodash#1.3.1: lodash#<2.0.0 is no longer maintained. Upgrade to lodash#^3.0.0
npm WARN deprecated CSSselect#0.7.0: the module is now available as 'css-select'
npm WARN deprecated CSSwhat#0.4.7: the module is now available as 'css-what'
npm WARN deprecated lodash#1.2.1: lodash#<2.0.0 is no longer maintained. Upgrade to lodash#^3.0.0
/usr/local/lib
├── generator-mean-seed#1.1.26
└── UNMET PEER DEPENDENCY yo#>=1.0.0
npm WARN generator-mean-seed#1.1.26 requires a peer of yo#>=1.0.0 but none was installed.
It says that i need yo installed with version > 1.0.0 but i already have that installed
yo --version
1.6.0
Any idea on what i am doing wrong or any clue to fix this?
I had the same problem ... the reason seems that the installation of peer dependencies changed in later version of npm. As a workaround, include yo when installing generator-mean-seed (it doesn't matter it's already installed):
$ sudo npm install -g yo generator-mean-seed
this way, generator-mean-seed will install correctly:
$ sudo npm install -g yo generator-mean-seed
npm WARN deprecated lodash#1.3.1: lodash#<3.0.0 is no longer maintained. Upgrade to lodash#^4.0.0.
npm WARN deprecated CSSselect#0.7.0: the module is now available as 'css-select'
npm WARN deprecated CSSwhat#0.4.7: the module is now available as 'css-what'
npm WARN deprecated lodash#1.2.1: lodash#<3.0.0 is no longer maintained. Upgrade to lodash#^4.0.0.
npm WARN deprecated graceful-fs#3.0.8: graceful-fs version 3 and before will fail on newer node releases. Please update to graceful-fs#^4.0.0 as soon as possible.
npm WARN deprecated npmconf#2.1.2: this package has been reintegrated into npm and is now out of date with respect to npm
/usr/local/bin/yo -> /usr/local/lib/node_modules/yo/lib/cli.js
> yo#1.7.0 postinstall /usr/local/lib/node_modules/yo
> yodoctor

Resources