I am trying to access an SQLite database from Node-Red. Node-Red is unable to open the DB. My OS is Ubuntu 18.04.3.
My flow and SQLite node definitions are provided below. The inject and debug nodes only have default values. I am keeping it very simple since this is my first attempt at SQLite with Node-Red.
When I deploy my flow, I get the following error:
The db has read-write-execute privileges for all users. It is local on my machine and I am the only one using it.
Any idea what could be causing the issue ?
All right here is how I solved the issue.
I was also having problems opening .csv files. By looking at other similar posts it seemed to be a user privilege problem which could not be resolved, even by changing the file privileges with chmod.
I had installed all the node components using different mediums:
nodejs and npm from the command line
node-red from the Ubuntu Software Center
node-red-dashboard and node-red-node-sqlite from the node-red browser.
These different installation mediums might have caused privilege issues. So I uninstalled everything.
I then reinstalled everything from the command line. Node packages were installed globally (i.e. with "-g" attribute):
sudo apt install nodejs
sudo apt install npm
sudo npm install -g node-red
sudo npm install -g node-red-dashboard
sudo npm install -g node-red-node-sqlite
I then confirmed npm could see everything as global packages:
sudo npm list -g --depth 0
I now launch node-red in a shell:
node-red
Then by going to a browser and typing:
localhost:1880
the node-red browser loads, all dashboard and sqlite nodes are available and I am able to read sqlite & csv files.
*** Note regarding installing node-red sub-packages ***
Node-red sub-packages (node-red-dashboard, node-red-node-sqlite, ...) can be installed from npm or from the node-red browser.
However I noticed a few things:
a sub-package installed from the browser will not show up when typing npm list -g --depth 0.
a sub-package installed with sudo npm -g <sub-package> will show up with npm list -g --depth 0.
packages listed in the browser will not all show up with command npm list <package>.
So I decided to play it safe and install all my node-red sub-packages with npm list. First I search for my sub-package in the node-red browser palett list, I retrieve the sub-package name, then I install it from the shell using sudo npm -g <sub-package>.
Consistency solved the problem: installing everything from the shell as global packages.
Related
Here's the entire error message....
Command 'ASK: Deploy the skill' resulted in an error (ASK CLI v1 is not functional. Command failed: C:\WINDOWS\system32\cmd.exe /q /s /c "ask init -l" error: unknown option '-l' )
Happens when I 'ASK deploy' or any ASK command. Anybody have any ideas what that means?
TIA!!
I figured it out and assuming you are a windows user, this may be your issue.
Before you install ASK-CLI on Windows, you must install the Node.js windows-build-tools package. Before you install windows-build-tools, make sure you have the version of Node.js that the package requires. If you have already installed ASK-CLI you need to uninstall it. Then install it again after you have installed windows-build-tools.
To install windows-build-tools, first open PowerShell with the Run as Administrator option, then type npm install -g --production windows-build-tools.
After I did this, I had to delete and recreate my ASK project, then my ASK deployments started working.
Reference: https://developer.amazon.com/en-US/docs/alexa/smapi/quick-start-alexa-skills-kit-command-line-interface.html
I have a step by step to setup a new environment:
npm install -g --production windows-build-tools
npm install -g ask-cli
ask configure
npm install -g lambda-local
Please assure that you are running the command as Administrator or using sudo on Linux.
I'm using Mac OS 10.15.2, Terminal 2.10.
I'm trying to install firebase tools to allow me to upload my experiment to firebase.
The following is what I used to do, which had been giving me success. But today, I'm using a new computer, and the installations were unsuccessful. I'm pasting the record in command line, as a screenshot, here for your reference
.
Thank you very much!
You are using the wrong package. You should be using "firebase-tools" instead of "firebase-cli". Be sure to read through the warnings and errors carefully.
Uninstall the old firebase-cli package:
sudo npm uninstall -g firebase-cli
Then install the correct firebase-tools package:
sudo npm install -g firebase-tools
Try running the command with sudo i.e use the command
sudo npm install -g firebase-tools
I cannot, as the title suggests, upgrade or in any way remove the current version of firebase off my system and I don't understand why. I installed it using the firebase commands prompted when you first start a project, something in line with npm install -g firebase-tools. After I've installed other packages to go along with it and I've upgraded the packages accordingly.
Now I want to remove the package I just do not understand how to do it. I've run
npm uninstall -g firebase-tools
npm uninstall -g firebase-admin
npm uninstall -g firebase-functions
npm uninstall -g firebase*
...and many other variations. After a while of trying I just figured I'll check what packages may still be left.
npm ls | grep firebase
Shows no firebase packages are still installed, however, running any firebase command will still work perfectly. Running firebase --version I get 3.15.4. I've also, just as a Hail Mary, tried running apt remove --purge firebase*
Further digging I figured that maybe the npm ls command was off, so I tried reinstalling all firebase packages. I ran it again and there they were, however* firebase was now at version 4.12.1. Running firebase --version still produce 3.15.4.
I'm really lost at this point. All help articles relating to uninstalling firebase leads to either how to delete projects or databases or to npm's how to uninstall a package website.
Sincerely.
You can't delete it, because you need to remove entire folder. This worked for me when I ran into the same problem:
which firebase
This locates the folder where firebase is (in Mac case it's /usr/local/bin/firebase) and then you do:
rm /usr/local/bin/firebase
Now do firebase -V and you'll get Command firebase not found. And now you can install back firebase with the real latest actual version:
npm i -g firebase-tools#latest
However, if you run firebase it will still give you Command firebase not found for what you can do this:
alias firebase="`npm config get prefix`/bin/firebase"
Worked for me with almost exactly the same problem.
Hope this helps you too!
I am trying to (re)install Firebase, however, when I run sudo npm install -g firebase-tools the following error shows up:
I have no idea what is wrong, it used to work well a few month ago.
You try running
npm cache clean
and then trying to install again.
If the error is not lost try below
Have you tried installing homebridge with the --unsafe-perm option?
sudo npm install -g --unsafe-perm homebridge
If npm detects it is running as root it drops to a non-privileged user which then doesn't have permissions to write to /root/.node-gyp. The --unsafe-perm option stops it from changing user.
nvm doesn't have this problem when not using sudo because it stores everything under the current users' home directory.
I've installed grunt using sudo npm install grunt and now I can't remove it.
I've tried:
$ sudo npm uninstall grunt
But it gives me a WARN:
npm WARN uninstall not installed in /home/kuba/projects/node_modules: "grunt-cli"
I've also tried rm, remove and unlink. and -g options, but those give:
npm WARN uninstall not installed in /usr/lib/node_modules: "grunt"
But I still can run grunt from command line.
EDIT:
$ whereis grunt
grunt: /usr/local/bin/grunt
$ file /usr/local/bin/grunt
/usr/local/bin/grunt: symbolic link to `../lib/node_modules/grunt/bin/grunt'
$ ls /usr/local/lib/node_modules
grunt jshint
$ ls /usr/lib/node_modules
bower csslint devtools-terminal npm plato
Why I have 2 directories with npm? Is it safe to just delete them?
EDITOR NOTE:
This question was asked over 5 years ago as How to uninstall npm package. It's been a very useful question favourited by many, who found a solution to their problem, so I'm changing it back from a recent edit that called it How to uninstall grunt package, because it requires the same procedure as any other npm package.
To uninstall a npm module from project node_modules folder, run:
npm uninstall <module> --save
Note that npm modules should be uninstalled from the same directory that contains the node_modules folder when running this command. The --save option will also remove it from your package.json
One can also remove a local dependency/module installation, by deleting its directory from the local node_modules folder. Yes, it's safe to delete dependencies there.
To uninstall a npm module that was installed globally, run:
npm uninstall -g <module>
It doesn't matter where you run this command from.
To install a npm module, run: (only meant as reference)
npm install <module>
...or:
npm install (if there's a package.json file at the root of your project)
...or:
npm install <module> --save-dev (if you want to add a minimum version to the dependency)
Good things to know about Grunt:
If you have installed grunt stable before February 18, 2013 (the day grunt v0.4.x was released), you might have an older grunt version still lingering in your system. That's because grunt versions lower than 0.4.x were installed globally, which caused a lot of pain when upgrading/maintaining versions.
grunt and grunt-cli are two different things.
grunt (without the "cli") is usually installed at the project level (when listed as a devDependency in package.json) by running npm install. That's also known as a local installation.
grunt-cli is the underlying foundation on which local versions of grunt run in different projects/folders. It can be installed locally, but is more useful when installed globally, once.
grunt is only installed locally (by running npm install grunt).
grunt-cli is preferably installed globally (by running npm install -g grunt-cli). grunt-cli official npm page still warns against installing grunt (without the cli) globally.
If you want to uninstall the global installation of grunt-cli, run npm uninstall -g grunt-cli. This issue on gruntjs's project supports this procedure.
Never install grunt globally (by running npm install -g grunt).
On npm and sudo
sudo doesn't play well with npm. Only use it if you must. Below are two quotes on the advantages and disadvantages on its use:
Quoting Isaac Z. Schlueter on his Introduction to npm article:
I strongly encourage you not to do package management with sudo!
Packages can run arbitrary scripts, which makes sudoing a package manager command
as safe as a chainsaw haircut. Sure, it's fast and definitely going to cut
through any obstacles, but you might actually want that obstacle to stay there.
I recommend doing this once instead:
sudo chown -R $USER /usr/local
That sets your user account as the owner of the /usr/local directory, so that you can
just issue normal commands in there. Then you won't ever have to use sudo when you
install node or issue npm commands.
It's much better this way. /usr/local is supposed to be the stuff you installed, after all.
Yet another catch mentioned by Andrei Karpushonak:
There are certain security concerns and functionality limitations
regarding changing the ownership of /usr/local to the current user:
if there is another user on the machine who could use global
npm packages - do not change the ownership of /usr/local
https://apple.stackexchange.com/questions/1393/are-my-permissions-for-usr-local-correct
https://askubuntu.com/questions/261326/is-it-safe-to-chown-usr-local
Having said that, if you want to install global module without using sudo,
I don't see any better solution (from pragmatic point of view) than mentioned.
Security vs easy of use is very broad topic, and there is no easy answer for that
- it just depends on your requirements.
This same thing happened with me. On doing
which grunt
I got path /usr/local/bin/. There was a folder grunt inside this.
But on running command (even from within the path /usr/local/bin/):
sudo npm uninstall -g grunt
Got the warning uninstall not installed
Solution: turns out that I installed using command
sudo npm install -g grunt-cli
And while trying to remove was just typing grunt.
So once I run
sudo npm uninstall -g grunt-cli
grunt got removed.
Although you have mention in question that you run
sudo npm install grunt
But still check if you are also doing the same mistake and run it with grunt-cli.
In some cases it may be necessary to use npm's "remove a package," feature.
npm - Remove a package
Description
"This uninstalls a package, completely removing everything npm installed on its behalf."
On your third code block, you posted this message:
npm WARN uninstall not installed in /home/kuba/projects/node_modules: "grunt-cli"
I've found that using the
which grunt
or the
whereis grunt
commands in the CLI/console provides an incomplete and confusing output.
Both of these commands will return the path of the grunt-cli installation, but return this simply as grunt.
Also using,
which grunt-cli
or the
whereis grunt-cli
fails to return any output to the CLI console. I believe that this is a namespace issue/feature with npm.
I also had a situation where I was unable to uninstall the grunt-cli with npm's uninstall function as recommended by other contributors above.
The only thing that worked for me was using the npm remove function with the program's full name as demonstrated below.
npm rm -g grunt-cli
This should return the following to your console.
unbuild grunt-cli##.##.#
Good Luck!
Use first this one
which grunt-cli
Or
which grunt
And this will show you the path to the module
In my case it was in the /usr/local/bin/
Once I got into the bin folder I just wrote
sudo rm grunt
And that was the end of it :)
If it's installed globally add -g to uninstall and probably you will need sudo
sudo npm uninstall -g grunt
Running the accepted solution's commands didn't work for me. Running which grunt would result in /usr/local/bin/grunt, but normal (or sudo) npm uninstall -g grunt-cli had no effect.
This is the command that finally worked for me:
sudo npm uninstall grunt-cli -g --prefix=/usr/local
Thanks to gengxuelei on github for the solution!