Sublime 3 text - automatically build system when saving a file - node.js

How to disable auto-build, when I am trying to save a file in sublime3?
There's no shortcut problem. I checked the Tool-Build and the shortcut for this is CTRL+B. The shortcut for saving files is CTRL+S. But it always automatically builds a system when I want to save any files in sublime.
The message said:
npm install.
I tried to remove npm and node by using sudo rm -rf /usr/local/{bin/{node,npm},lib/node_modules/npm,lib/node,share/man/*/node.*}
. These two are removed because I can't find anything from terminal by checking node -v and npm -v. However, when I try to save file in sublime3 again, it still runs the npm install, even though it said can't find path this time.

I solved it! Click sublime text-preference-package setting- npminstall-setting user-{"install_on_save": false}-save it.
I checked my sublime3, it's not a shortcut problem because shortcut for build is still ctrl+B and the shortcut for save file is ctrl+S.
I removed the npm and node from terminal but when it still shows npm saving when I want to save a file.
So I checked the sublime again and found npminstall package in preference. Now i have to reinstall node and npm.

Related

"Command 'npm' not found" after open terminal, but npm -v show it is installed (installation used nvm)

I installed npm and node using nvm, and it work's fine, but after computer rebot it shows some errors.
Right after rebot open dialog (in Polish language) saying:
error loading the file /home/pawel/.profile
/home/pawel/.bashrc: line 5: npm: command not found
You are using nvm which allows you to have multiple versions of Node.js and to automatically select one of them. This works by placing a script at the end of your .bashrc that allows the correct Node.js to be picked up. So if you try to access npm in the beginning of that same script, it won't work because that path has not been set up.

npm error on every command: EEXIST: file already exists, mkdir 'c:\users\user\appdata\Roaming\npm'

I'm just new to node and npm and this is frustrating.
Well it's almost all said in the title.
On a Windows 10 x64 using a NON elevated prompt, all npm commands shows:
EEXIST: file already exists, mkdir 'c:\Users\Josep\AppData\Roaming\npm'
at Error (native)
Even npm -v shows it twice before the version number.
Not hapening in an elevated prompt. version numbers differ in an elevated and a user prompt.
Double checked PATH variable. Same on two cmd windows.
Node version 6.10.0
NPM Versions: 4.3.0 at elevated prompt and 3.10.10 at a user prompt.
For me, just adding --force solved it.
I had similar issue, solved it by removing .npmrc file, located at c:\Users\<USER>\ location.
I believe it was caused by running earlier npm config set in wrong location.
Kudos to this comments thread.
In my case remove white space from folder name.
Try reinstalling node and npm for the non-admin account. If that's not an option, you can use the portable version:
Download from http://nodejs.org/dist/
Extract the archive.
Open cmd and cd to the extracted folder.
Run nodevars.bat.
It will set PATH and other things so you can now use node from this folder.
I also had this problem. Just delete npm folder, it will be created again. This problem is due to user privileges.
this is because you have same file in node_modules/Cypress/bin and node_modules/.bin, which is cypress(type=file).
Remove cypress(type=file) from node_modules/.bin, this will resolve the issue.
it happened to me, I had a space in my folders path C:\Users\Jhon Doe, should be C:\Users\JhonDoe.
Microsoft has a bit more information about how this can happen: https://learn.microsoft.com/en-US/troubleshoot/windows-client/user-profiles-and-logon/renaming-user-account-not-change-profile-path
For me, cd ios && pod install && cd .. fixed it.
I had the same issue and was able to resolve it on Windows by running the cmd prompt as Admin.
Go to the folder where you have installed Cypress. For example D:\cypressautomation --> then go to "node_modules" --> and then ".bin" folder. Here in this folder, if there is any file named "cypress", then just delete it (before deleting I think cypress needs to be closed). Reopen the cypress. This worked perfectly fine for me.
In my case. edid like below
※one more, check white space from folder name.

Can't run npm or any Node Module on Cmder (Windows 7)

I simply can't run "npm" or, for instance, "gulp" in my cmder. But I can run it if I manually open the cmd
λ gulp
'gulp' is not recognized as an internal or external command,
operable program or batch file.
If I run npm manually from the Nodejs directory, it works. So I added an alias with alias npm=C:\Progra~1\nodejs\npm.cmd $* and now npm works, but I guess that's not the best solution, since I can't run Node modules.
What I've tried
I've tried to add "%APPDATA%\npm\node_modules" and
"AppData\Roaming\npm" to both System and User environment variables
Restarting the computer
Running cmd as admin inside of Cmder
Add "%APPDATA%\npm\node_modules" and "AppData\Roaming\npm" to
"Cmder's user-startup.cmd" path.
I can run Ruby's gem or Python inside of cmder just fine, but Node just won't work specifically inside of Cmder (but will work on window's native cmd.exe)
Fixed
Download the lastest version of Cmder through the github repo https://github.com/cmderdev/ instead of downloading it from the website.
Add the "C:\Progra~1\nodejs\" to your user path in Windows using the System Properties window. Restart Cmder. Cmder can then see all the nodejs related executables, including npm.
The standard release from the website will work.
source: this has worked for me.
Run cmder as admin..
The reason why the workaround (moving files in the same directory) works is because running the cmder does not have privileges to access files outside of its directory. So either give it orivelages or Run as Admin. That it expands da the paths it can access and removes limitations/restrictions.
problem solved
For me what worked was using the cmder from selecting save file instead of open with Windows Explorer (default)
Briefly:
Create shortcuts for npm.cmd and npx.cmd and put them to ../cmder/bin/ folder.
Detailed:
Install nodejs. For example, to C:/Program Files/nodejs
Install cmder. For example, to C:/cmder
Go to nodejs folder and create shortcuts for npm.cmd and npx.cmd (right click - create shortcut). Windows will show message that cannot create here, will be created on Desktop instead - agree.
Copy shortcuts from Desktop to /cmder/bin/.
Rename them to npm.cmd and npx.cmd relatively (remove - Shortcut).
Reopen cmder, run npm.

bower is not recognised as an internal or external command

I have successfully installed nodejs, and express framework, however I downloaded bower via
npm install -g bower
which ran successfully.
However whenever I try to install something with bower I get the error message
bower is not recognised as an internal or external command
when I search my computer for bower or a bower.exe I cannot locate it.
I am using Windows 7 as well and had this problem too.
After I took the steps outlined in Scott Marchant's answer, bower worked.
Find the location of your npm global binaries: npm config get prefix. This path may look something like C:\Users\username\AppData\Roaming\npm.
Add the path from step 1 to your Path.
Open the Windows Control Panel, search for environment, then click on either edit environment variables for your account, or Edit the system environment variables`.
Find the variable named Path or PATH, or create one if it doesn't exist.
Paste the path from step 1 here (; delimited).
You may need to restart your command prompt window.
You should now be able to enter bower commands.
I solved this issue using command
$ npm install -g bower
make sure -g exist in command.
I am using os Window10.
Installing Bower Windows:
Install Node.js (required)
npm install -g bower
Add to the Path environment variable for your both Systems and Users like this:
;C:\Users\me\AppData\Roaming\npm\node_modules\bower\bin
Restart your machine
Open command prompt anywhere and type bower to verify that it works. DONE.
Open cmd
Check bower is installed successfully:
bower version -v
If bower version showed then go to step 3, else execute:
npm install -g bower
to install bower
Close and re-open cmd (to apply new environment variables)
using CD command to navigate to folder that has bower.json file then run
bower install
DONE.
Sometimes even after Scott's steps do not resolve the problem. Open the command prompt in admin mode. This resolves the problem
Press Window+R
%appdata% Press Enter Key
C:\Users\xyz\AppData\Roaming\npm
Double Click bower.cmd icon
Press Shift Right Mouse Click Then Selec Open Command Window Here
Paste bower install MDBootstrap
SCREENSHOT
Check were your cmd prompt/bash is located when you have successfully commanded "npm install"
Look for the any of the following.
-bower.cmd - windows command script
-bower - file
you can do a quick search in the directory.
if you find it, copy the path to the file.
"I found mine in the directory where I successfully performed npm install" + node_modules.bin" - "D:\Work\notepadplusplus\htdocs\laravel-main\angulartest\public\fed\node_modules.bin"
Then do these
Open the Windows Control Panel
Go to Advance
Environment Variables
Click on either edit environment variables for your account, or Edit the system environment variables`.
Find the variable named Path or PATH, or create one if it doesn't exist.
Paste the path from your search earlier (; delimited and without any space).
restart your command prompt window or your bash window.
There is no specific path since we all have different structure of our directories.
The only precise thing here is to find the bower.cmd location and that will be used to the Path to your windows environment.
Although we have already good answers here, I will give an extra hint. Check if you have a .npmrc file inside the folder /Users/YOUR_USER/. When this problem happened to me, my .npmrc file had this content:
http_proxy=http://<LOGIN>:<PASSWORD>#<PROXY>:<PORT>
https_proxy=http://<LOGIN>:<PASSWORD>#<PROXY>:<PORT>
proxy=http://<LOGIN>:<PASSWORD>#<PROXY>:<PORT>/
https-proxy=http://<LOGIN>:<PASSWORD>#<PROXY>:<PORT>
prefix = "D:\\<SOME_DIR>\\nodejs"
cache = "D:\\<SOME_DIR>\\nodejs\\npm-cache"
Due to prefix and cache lines, the bower was being installed inside the folder specified in prefix.
SOLUTION: I deleted prefix and cache lines. The I installed bower again with the following command:
npm install -g bower
After that, my bower became global as expected.
C:\Users\[username]\AppData\Roaming\npm;
should exist in PATH for both "User Variables" and "System Variables"
I have faced the same problem. I have solved by using the following steps
Go to Control Panel\System and Security\System and click Advanced system settings
In that you can see Environment Variables in Advanced tab. Now ,Environment Variables Window opens.
Select the path and click Edit button and add C:\Users\\AppData\Roaming\npm . Click ok to save.
Note : before adding path add a colon(;) in front of that path if not there for previous one
Now you can able to install bower . Hope it helps.
I resolved the issue my changing access rights of node.js folder. I gave Read-Write access to the file and issue resolved. node.js file path: C:\Program Files\nodejs
I just wanted to add update to windows 10 users,
I found that typing bower into the search bar will return "run command" option. Execute that and it will then prompt if bower can submit info, return a y/n and you should be good to go.
Add the directory of bower to the PATH environment variable.
Avoid having any space between directories:
C:\Program Files\nodejs;C:\Users\W\AppData\Roaming\npm\node_modules\bower\bin;C:\Users\W\AppData\Roaming\npm
To me it helped to remove the user variable and write the PATH environment variable in the System variables.

Grunt on Windows 8: 'grunt' is not recognized

I'm having a problem running Grunt from the command line on my Windows 8 machine.
My research indicates the most common solution is to install grunt-cli, since Grunt is no longer global. I also need to make sure I actually install the Grunt task runner, since that's not installed with grunt-cli.
Other solutions point to the PATH system environment variable, but that appears to be pointed as I'd expect to:
C:\Users[username]\AppData\Roaming\npm
Having done all that, I'm still getting a "'grunt' is not recognized as an internal or external command, operable program or batch file" error message in the CLI. I've tried the following things, uninstalling everything after every attempt:
Installed grunt-cli globally (npm install -g grunt-cli), then grunt at the directory level I want to use it (npm install grunt)
The same as above, but with the order of installation reversed
The same as both of the above, but using the Admin Command Prompt
Am I missing something obvious?
I've not had any issues with grunt on several different windows 8 machines.
If you open the folder: C:\Users\[username]\AppData\Roaming\npm
Do you have a file named grunt.cmd in this folder?
If not I'd maybe try npm install -g grunt-cli again, maybe from an elevated command prompt.
If this exists and you have C:\Users\[username]\AppData\Roaming\npm in your PATH environment variable then typing grunt from a command prompt should work.
Silly question, have you tried closing the command prompt and opening a new one?
Confirm your PATH is correct (and not messed up). Just type PATH from the command prompt. There's really no other explanation that makes sense given the error you're describing and the steps you've taken.
Normally, using the where grunt command would have found grunt.cmd in your path if npm is installed correctly and it has been properly added to the system path.
Close all Command Prompt instances.
Start a new Command Prompt instance.
Type PATH Enter and verify if C:\Users\Username\AppData\Roaming\npm is part of the path.
If not, you need to log off and on again,or close the Command Prompt and restart the explorer process.
In the Command Prompt, type where grunt Enter.
You're good if it reports:
C:\Users\Username\AppData\Roaming\npm\grunt
C:\Users\Username\AppData\Roaming\npm\grunt.cmd
Otherwise, you have to reinstall the grunt-cli package if it reports:
INFO: Could not find files for the given pattern(s).
Apparently, programs that change the PATH environment variable must broadcast a WM_SETTINGCHANGE message. The Windows' System settings window does it correctly when you change the PATH variable, but the NPM installer doesn't. That's why you have to restart explorer (or log off or restart, which has the same effect).
I know this has been answered but I thought I'd offer my step by step solution for windows 8.
First thing I checked was the PATH in my laptops Environment Variables (Right click my computer > properties > advanced system settings > Environment Variables)
It wasn't listed in there so I added a new variable in User variables (so it was specific only to my user account)
In the new user variable prompt I entered the following;
Variable Name: PATH
Variable Value: %USERPROFILE%\AppData\Roaming\npm
Quit command prompt, repoened, navigated to my projects directory and tried running grunt again and... SUCCESS!
I had the same issue.
I tried different things:
Restart computer
Deleted the grunt folder and ran
npm install -g grunt -cli
Didn't work.
Finally tried:
npm install -g grunt-cli
Worked perfectly.
Tried
where grunt
and I saw 2 locations where it was found.
I was facing the same problem on windows 8
I have added ' %APPDATA%\npm ' to the path variable . It has been working fine.
some times NPM install corrupts the basic windows path. i usually have a copy of my own version of PATH mainted separately. every week or on some installs i manually configure and update the %PATH% variable.
Basically Grunt.cmd is not availbe through %PATH% variable.
I have stucked with problem on Windows 8, that after install grunt-cli I've always got "command not found" while I'm tried to check grunt -v or where grunt. So I've added to enviroment PATH this path C:\Program Files (x86)\Git\local and run grunt.cmd from that folder (you need to look in node_modules folder here). And after reloading my terminal everything started to work.
Same happened to me and here was the solution:
Have you got 2 different versions of Node.JS installed?
Maybe Nodist?
This means you likely got NPM installed twice which will install the commands into 2 different folders:
Once into C:\Users\<user>\AppData\Roaming\npm and once into C:\dev\nodist\bin\bin.
C:\dev\nodist\bin\bin wasn't on my path variable so I added it, and I removed the Node.JS version I didn't want to use.
If you have no grunt.cmd file created by npm, make sure that you do not have a .npmrc in your home directory with: bin-links=false in it.
After getting a tonne of "'grunt' is not recognized as an internal or external command," errors, I solved this on Windows 10 by going to Path and adding C:\Users\Username\AppData\Roaming\npm

Resources