SailsJS not updating - npm

I haven't used sails in a long while and was about to start a new project but wanted to update my older 0.12.14 version to 1.0.2. I first tried doing
$ npm update -g
and then running
$ sails -v
This returned
0.12.14
Confused, I listed the npm global packages
$ npm list -g --depth=0
and this returned the list of global packages without sails.
I tried
$ npm uninstall sails -g
and when running
$ sails -v
or even
$ sails new test
it appeared to continue working. Checking the version in the package.json of the test project revealed that the old version was still alive and kicking. I'm out of ideas on how to update / uninstall sails.

To update Sails.JS, use npm install sails -g instead of npm update -g
If that isn't working, be sure to update to the latest npm & Node.JS:
sudo npm cache clean -f
sudo npm install -g n
sudo n stable
then
sudo npm install sails -g
To manually download and install Node.JS: https://nodejs.org/en/

Related

npm install -g -D not updating dev dependencies in package.json

I've tried opening and closing the open package.json editor, and restarting VS Code, and running and re-running the npm install command at least 8 times but to no avail.
For some reason, the command below does not update my dev dependencies in my package.json file.
$ npm install -g -D webpack
I know I can manually add the dependency but just saying and this is driving me nuts.
Your are passing the option -g which makes npm install the package globally so you can execute the binary directly, remove that flag to install the package locally.
Can you try: $ npm install --save-dev webpack
This is the recommended way to install webpack from npmjs

Why I can't get NPM upgraded?

Here is how I install NPM on a Linux Mint 19.
sudo apt install nodejs
sudo apt install npm
The NPM version I get is 3.5.2, which is not the current version. To upgrade, I try the following commands.
sudo npm install latest-version
which has a few warning messages such as "not such file or directory, open '/home/me/package.json'"
and
sudo mpn install npm#latest -g
which runs without any warning or error messages.
The command
npm -v
still yields 3.5.2.
What is missing?
Also, the reason of using sudo in those upgrade commands is to work around some access permission.
try running:
which npm
and
sudo which npm
I suspect by running sudo apt-get ... you installed npm for your root user as opposed to your current user.
Try this command: npm install -g npm#latest or npm install -g npm#next
You can update NPM with: npm install -g npm.
See this Q&A for more variations that might occur/needed.

Typescript npm install not working

When I run sudo npm install -g typescript the only thing that gets installed is test3. This is what I get:
$ sudo npm install -g typescript
Password:
test3#1.0.0 /usr/local/lib/node_modules/test3
$ tsc
-bash: tsc: command not found
The Typescript compiler is never installed. I reinstalled node/npm just now to see if it was an install issue, but that didn't seem to fix it. Any ideas?

Which npm version is correct?

I just install npm 2.11.1,but when I use npm -v command it tells me the version is 2.10.1.
I want to know what's wrong and how can I handle it?
My computer is Windows operating system
If you install n you can update your npm to the latest stable version by this command
sudo npm cache clean -f
sudo npm install -g n
sudo n stable
UPDATE :
for windows you can download and run the latest MSI. The MSI will update your installed node and npm.

NPM -g update gives me many WARN dependency errors

Should I delete my node modules folder and reinstall everything again?
It appears that following David Walsh's way of updating Node has resolved my problem.
sudo npm cache clean -f
sudo npm install -g n
sudo n stable