Sonos Simulator not able to compile node package - node.js

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!

Related

NPM getting 404 on installing packages

I'm trying to install packages for an angular project based on a template of the customer.
He has provided me this let's say ready to use template, but when I run npm install I get errors.
npm ERR! code E404
npm ERR! 404 Not Found - GET https://artifactory.springlab.enel.com/artifactory/api/npm/npm-public/#angular-devkit%2fbuild-angular
npm ERR! 404
npm ERR! 404 '#angular-devkit/build-angular#~0.1102.19' is not in this registry.
npm ERR! 404
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git URL.
As you can see the issue is on a GET from a server of theirs. I have highlighted this issue but they said that is not their fault as they can run npm install without any issue.
Please note that:
When I run the npm install I'm logged in inside their VPN to access the servers.
I've tried several versions of node and npm, using the same version that is working on their machines.
I've tried both --force and --legacy-peer-deps and I always get the same error.
I have no issues on npm in any of the other 10s projects I work on (for other customers)
I have also disabled the antivirus.
IT support from the company is not providing me with help, so I'm alone and I don't know what to check.
How can I get more details on why I got a 404 on that?

why npm/yarn install tries to pull old version even specific defined?

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?

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.

Why am I getting Unexpected token '\u0000' when using npm install -g package

This is probably a Windows specific issue but I haven't found any information when googling this issue. I had been using ionic framework which relies on Cordova (or Phonegap). However, the problem is not specific to any of these packages. I see this error quite often. So, the error is when I run a command such as the following:
npm install -g cordova
However, I could substitute various other packages and get the same error. I'll paste the snippet (very brief) below of the error message. What is strange is that I had an ionic project working in that directory earlier. Then today it told me that ionic could not be found. My hunch is that this is a different issue than the main issue I am describing here.
I installed git bash so I do have a linux-like environment that I could try. I would just select Git Bash for a bash window with various bash commands. If there is an easier way to fix this for Windows users, please let me know. I have seen courses on Pluralsight where the instructors seem to be happily using npm with no problems. Also, when I use yeoman, I also at some point, in many cases, get the same error.
The error is
npm ERR! Failed to parse json
npm Unexpected token '\u0000' at 1:1
npm ERR!
npm ERR! ^
npm ERR! File: c:\Users\Bruce\AppData\Roaming\npm-cache\amdefine\1.0.0\package\package.json
npm ERR! Failed to parse package.json data.
npm ERR! package.json must be actual JSON, not just JavaScript.
npm ERR!
npm ERR! This is not a bug in npm
npm ERR! Tell the package author to fix their package.json file. JSON.parse.
Thanks in advance for any help/advice,
Bruce
Via this question on SO it could be that you just have to do:
npm cache clean.
But, also try the other methods suggested there like adding the registry option:
npm install <packagename> --registry http://registry.npmjs.org/.
Or, if you've been mingling with the package.json file by yourself, check if it's valid.

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.

Resources