I am trying to globally install eslint on my mac to use in vs code and it is returning the command not found. does anybody have any idea on how to fix this?
What specifically is not "found"? Is it NPM? If so, check your PATH variable.
Since you are using a Mac, it should be here:
/usr/local/bin/npm
Also, this is a very generic and common question, please do some more research before posting here.
Edit: As per my comment below.
Are you passing $: at the start of that command? In most documentation, this refers to the shell command prompt and should not be included in the command.
Related
I am new to node.js and Github. I was trying to save some work by using command git add -A and the then I saw these lines below and some many of the lines are just running non-stop. I typed ctrl+c to stop it, but anyone knows what are just happened or what did I do wrong??
Thanks
This is because of how git treats the space character.
Find more info here: https://stackoverflow.com/a/1967986/2874959
Thanks #bcorbella for the answer. Just a small precision to be sure you won't do this as a beginner but never add the node_modules into your git project. Create a .gitignore file with at least:
node_modules
Use npm init, npm install <module> --save to create a package.json... then do simply a npm install when you are checking your project.
More info in here https://docs.npmjs.com/getting-started/using-a-package.json
try setting the config core.eol to native and see if you will get the same error, i see no reason why you should be tracking the node_modules/ folder.
> git config --global core.eol native
So I followed the docs here:
https://github.com/modernizr/modernizr
1) cloned the repo using npm.
2) ran npm install inside modernizr to install its dependencies.
3) tried to run ./bin/modernizr -c lib/config-all.json
I am getting an error:
'.' is not recognized as an internal or external command
I am assuming that this has to do with the windows command line not understanding that I am trying to execute the file at that location. How can I do step 3 on cmd?
Thanks in advance.
Here we go. You need to run the modernizr bin from within node.
node .\bin\modernizr -c .\lib\config-all.json
Run the instructions in PowerShell. It does a better job of support *nix-style syntax and commands than the Command Prompt.
Use Git Bash (part of Git for Windows) or (iof you feel like going in the front door) Minimalist GNU For Windows (http://www.mingw.org/) It works fine.
I need to change my install of zombie.js from 4.0.7 to 3.1.x as specified here (Installing Zombie.js Error: ReferenceError: Set is not defined. What am I doing wrong?) to work through an example.
However I have no idea how to do this using the linux command line (nor did my search yield an answer to this). Is there a way to do this using npm?
npm install zombie#3.1.0 --save
On my way setting up Node.js with NVM, I stumbled upon an error when using Yeoman. I got
the error
Cannot find module 'yeoman-generator'
After some research I found this post on StackOverflow, which is also about my problem. Now I tried to do so, but the problem I have is, that I want to use different versions of Node.js over the system with the use of NVM. Now is it possible to change the $NODE_PATH dynamically, if the Node.js version changes with the help of NVM? Because my $NODE_PATH is empty at the moment (this is causing the problem).
$ which node
/Users/dschmidt/.nvm/v0.10.35/bin/node
$ which npm
/Users/dschmidt/.nvm/v0.10.35/bin/npm
$ echo $NODE_PATH
[empty]
Would be glad about every answer I get about this. I searched the web for this, but could not find one post about this specifically.
Adding following to .bashrc or .zshrc helps
export NODE_PATH=$NODE_PATH:`npm root -g`
I am not expert whether that is good.
source as pointed out by Pensierinmusica
NVM will set the path for node and npm once you run
nvm use <node_version>
However, that is just for the current shell and any new shells will not have a version of node an npm selected until your run the previous command unless you set a default version
nvm alias default <node_version>
voila! You have a working version of npm and node in any new shell you open.
To change the default simply run it again with the new version of node you want to use. e.g.
nvm alias default v5.4.0
I figured a way to make this work.
In your ~/.bash_rc file or ~/.zsh_rc add this line:
export NODE_PATH=`which node`
Open new shell or run this source ~/.bash_rc to pick up the changes
This (taken from GN. and Nick) works fine for me, but I needed to add it to ~/.bash_profile because I use Bash as a shell on my Mac
export NODE_PATH=`which node`
I would like to use Cleaver for a presentation. I followed the authors' instructions, which are:
Get it on NPM:
npm install -g cleaver
And run it like so:
cleaver path/to/something.md
Problem: Bash seems to recognize Cleaver as a registered program, but when processed with a markdown file, it doesn't seem produce any presentation, the prompt just accepts the command and no output is produced. Would be glad if someone can help me with this.
The issue was solved when the shebang was changed from #!/usr/bin/env node to #!/usr/bin/env nodejs
courtesy:
globally installed npm-packages not working