why npm/yarn install tries to pull old version even specific defined? - node.js

I'm trying to install "simple-get" npm library like:
npm install simple-get#4.0.1
but getting an error:
npm ERR! code E404
npm ERR! 404 Not Found - GET https://xxxxxxx/artifactory/api/npm/xxxxx/simple-get/-/simple-get-3.1.1.tgz
why it's trying to install 3.1.1 if I defined 4.0.1?
4.0.1 definitely exists in artifactory.
is it something I need to adjust in my .npmrc file? Or is it something specifically configured in our company artifactory?

Related

How can I downgrade to the specific version of node and npm on mac?

I am trying to downgrade node and npm in Mac for a specific project.
Current versions on my system.
npm - v
7.21.1
node -v
v16.9.1
I am trying to downgrade to these specific versions.
node v14.16.0 & npm 7.20.0.
Thanks in advance.
I tried doing it with npm install -g 7.20.0 but got the error
npm ERR! code E404
npm ERR! 404 Not Found - GET https://registry.npmjs.org/7.20.0 - Not found
npm ERR! 404
npm ERR! 404 '7.20.0#*' is not in the npm registry.
npm ERR! 404 You should bug the author to publish it (or use the name yourself!)
npm ERR! 404
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.
How can I do it? The reference that I could find was the installation process with Homebrew (which I don't want to use).
Nvm
You can use nvm(node version manager) to use different version of node js based on your project requirements
you can find more information on the official git repo
Usage
You can use nvm to manage different node version inside your system and still keep your latest version, you can also define a default node version for new shell instance.

Sonos Simulator not able to compile node package

Trying to install and utilize the https://developer.sonos.com/tools/developer-tools/sonos-simulator/
When following the install instructions and trying to install the node package via the npm install command within the directory it fails with a 404 error trying to find node-ssdp as seen from the snippet below:
P:\sonosDevel\sonos-simulator-0.4.34>npm install
npm notice
npm notice New minor version of npm available! 7.5.1 -> 7.6.3
npm notice Changelog: https://github.com/npm/cli/releases/tag/v7.6.3
npm notice Run npm install -g npm#7.6.3 to update!
npm notice
npm ERR! code E404
npm ERR! 404 Not Found - GET https://github.com/sonos/node-ssdp/archive/master.tar.gz
npm ERR! 404
npm ERR! 404 'node-ssdp#https://github.com/sonos/node-ssdp/archive/master.tar.gz' is not in the npm registry.
npm ERR! 404 You should bug the author to publish it (or use the name yourself!)
npm ERR! 404
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\duart\AppData\Local\npm-cache\_logs\2021-03-18T21_59_44_515Z-debug.log
I am doubtful there is much to do other than hope the sonos developers reupload the package and potentially update the Sonos Simulator but I may as well throw it on here to see if anyone has a solution to have get the Simulator running or perhaps some other solution to simulate a Sonos Device on the network without actually owning a Sonos device.
I was having a play around with this today, and managed to get it working.
I installed an old (4.x) version of node as this is what the documentation said it worked with (I honestly didn't try anything newer as I couldn't get the simulator to do what I wanted so uninstalled it after).
The main issue was with node-ssdp, as the included package file with the simulator was trying to get it from a repo that no longer exists. After some trial and error, I found that if you edit the package file to specify node-ssdp 2.7.0 (which is the version that was released when the simulator was), the npm install should go through ok. (If you install a newer version the simulator crashes a few seconds after you run it).
Hopefully this helps!

Sails.js missing modules

Experiencing npm module troubles using sails.js.
The first problem was - the contents of assets/ was not being replicated to .tmp/public as documentation indicates. There have been other errors as well.
Research has shown - there are missing modules, one of which is grunt. Doing a
npm install grunt
does make the .tmp/public start working.
But there have been other errors when trying to use the framework.
Install Details:
Server instance: Ubuntu 14.04.1 LTS
(recently deployed, no other changes to server except for node and sails.js)
node --version
v0.12.4
(built from sources)
npm -v
2.10.1
sails --version
0.11.0
sails installed using:
sudo npm install sails -g
Create a new application:
sails new testproject
cd testproject
npm list
produces a long list of missing npm modules to stderr:
npm ERR! missing: colors#~0.6.2, required by grunt#0.4.2
npm ERR! missing: grunt#~0.4.0, required by grunt-contrib-clean#0.5.0
npm ERR! missing: lodash#~2.4.1, required by grunt-contrib-coffee#0.10.1
npm ERR! missing: grunt#~0.4.0, required by grunt-contrib-coffee#0.10.1
npm ERR! missing: grunt#~0.4.0, required by grunt-contrib-concat#0.3.0
npm ERR! missing: grunt#~0.4.0, required by grunt-contrib-copy#0.5.0
and several others.
This seems inexplicable - how could this (missing npm modules) be overlooked? I am new to node - and could have missed something.
Reviewing the getting started page, I didn't notice anything obvious.
This framework seems well-designed - uses some great npm modules.
Has anybody experienced these and found what is needed to fix?
To resolve the missing: colors#~0.6.2, required by grunt#0.4.2 , just navigate to the node_modules/grunt, do a npm install to install the missing dependencies.

error while installing gruntjs (node.js/npm package)

I'm trying to install grunt.js. As the official docs says, I should run
npm install -g grunt-cli
as root (I'm using ubuntu linux). I'm trying - and I get the following error:
$ sudo npm install -g grunt-cli
npm ERR! sudon't!
npm ERR! sudon't! Running npm as root is not recommended!
npm ERR! sudon't! Seriously, don't do this!
npm ERR! sudon't!
npm ERR! couldn't read package.json in .
npm ERR! Error installing .
npm ERR! Error: ENOENT, No such file or directory 'package.json'
npm ERR! Report this *entire* log at <http://github.com/isaacs/npm/issues>
npm ERR! or email it to <npm-#googlegroups.com>
npm ERR! Just tweeting a tiny part of the error will not be helpful.
npm not ok
Can someone please explain:
[1] why npm says `sudon't` and grunt docs says `do sudo`? And what is it all about?
[2] I want to install the grunt as a tool. Why does the message complains about missing package.json which is project-dependent (and I don't want to run grunt on any project, I want to install it globally first)?
[3] what can I do to make it install successfully?
The solution was quite tricky... I'm using ubuntu oneiric ocelot, which was still maintained one week ago (it's not that old). I installed node.js through default ubuntu packages and it turned out to be the problem - I got 0.4.9 version installed, which seems to be old, odd and strange (I had no experience with node.js before). I removed it and followed instructions from https://github.com/joyent/node/wiki/Installing-Node.js-via-package-manager - added remote package repository and installed node.js from there. Now I've got a shiny 0.10.5 with sudo npm install working perfectly fine with no complaints.

How to override a npm install version check failure?

Is there a way to override npm's version checking against a packages.json file from command line (npm install command)?
I would like to try and install/run a package even though it doesn't match my node.js version.
This is the error I am getting:
npm ERR! Unsupported
npm ERR! Not compatible with your version of node/npm: canvas#0.6.0
npm ERR! Required: {"node":"0.4.x"}
npm ERR! Actual: {"npm":"1.0.8","node":"v0.5.0-pre"}
Thanks
What you could do is go to github package and update the package.json. Then just install it locally. But most of the times these version numbers are there for a reason. The node.js api changes sometimes(I believe 0.5.0-pre changed, because socket.io also fails with 0.5.0-pre).
If you for example install nvm, nave you can keep several version of node.js side-by-side easily.
If all else fails you could still manually download and copy the files in your node_modules folder

Resources