Windows: Unable to find "grunt.js" config file - npm

Under Windows, I am getting the following error when I run grunt on my project:
Unable to find "grunt.js" config file. Do you need any --help?
I have exactly the same configuration as my mac and its failing - anyone seen this?

Here's what I did to fix this:
Uninstalled grunt globally:
npm uninstall -g grunt
Installed grunt-cli globally:
npm install -g grunt-cli
Then, in project root dir:
npm install
And all is good. Hope this works for anyone else running into this.

Related

NPM global package install not working properly

Tearing my hair out over this.
I used to have a npm package called 'eleventy' installed globaly and working on my laptop. Today I find this: fish: Unknown command 'eleventy'
Tried this npm install -g eleventy and got this
+ eleventy#0.2.0
updated 1 package in 0.289s
Things tried from other posted questions:
npm get prefix outputs /usr/local
ls /usr/local/lib/node_modules/ outputs eleventy npm
but not eleventy found in /usr/local/bin
echo $PATH = /usr/local/php5/bin/ /usr/local/bin /usr/local/lib /usr/bin /bin /usr/sbin /sbin
Tried reinstalling npm and nodejs as well but no luck so far. Any help appreciated.
Okay, looks like I'm an idiot. I was installing the wrong package with a similar name.
I needed to use
npm install -g #11ty/eleventy

NPM cannot find nodejs

Every time I try to install something with npm or do npm install or anything else with npm, I get this: env: node: No such file or directory. Is there anything I can do about it? (i tried reinstalling it with homebrew and node.js's website)
Install node.js again as node -v or npm -v isn't working for you. Seems problem with node installation itself. You can download and install from https://nodejs.org/en/download/.

Installing npm globally

Is it possible to install npm globally and is this a good idea?
I installed npm with the npm install command and was able to run npm start. Then after publishing my project to github I wanted to make sure it would run if someone cloned it, so I cloned it to a different directory on my machine. I then had to run npm install again to install the dependencies. Is it necessary to do this for each project you build locally or is it better and possible to install it globally on your machine?
Thanks
Command line for install npm globally--
npm install -g <package>
For more read from here.
In general, the rule of thumb is:
If you’re installing something that you want to use in your program,
using require('whatever'), then install it locally, at the root of
your project.
If you’re installing something that you want to use in your shell, on
the command line or something, install it globally, so that its
binaries end up in your PATH environment variable.
Details you can read here.
To install a module from npm globally, you'll simply need to use the --global flag when running the install command to have the module install globally, rather than locally (to the current directory).
you can use command:
npm install <module> --globalor npm install <module> -g
note: <module> is the name of the module you want to install globally

Issue installing bower on windows

I'm using Windows 7 64bit and I install Bower with
npm install -g bower
It seems to install correctly.
npm http GET https://registry.npmjs.org/amdefine
npm http 304 https://registry.npmjs.org/amdefine
C:\Program Files (x86)\Git\local\bower -> C:\Program Files (x86)\Git\local\node_
modules\bower\bin\bower
bower#1.3.3 C:\Program Files (x86)\Git\local\node_modules\bower
...
But bower is not working:
$bower
sh.exe": bower: command not found
$bower -v
sh.exe": bower: command not found
What could be wrong?
Same problem but for me I had to add the Path Environment Variable that pointed to the AppData/Roming/ folder. I have no idea why node.js would install npm in the Roming folder. If I didn't have hidden folders turned on we never would have found it.
C:\Users\me\AppData\Roaming\npm;
Then npm works from Node.js command prompt, and bower works from GitBash.
Check if C:\Program Files (x86)\Git\local is added to your Path Environment Variable.
Check your version of node, I was running on v0.10.15 then updated to v0.10.35 and that fixed the issue for me.

Cannot install phantomJS in Karma

WARN [config]: config.configure() is deprecated, please use config.set() instead.
WARN [plugin]: Cannot find plugin "karma-phantomjs".
Did you forget to install it ?
npm install karma-phantomjs --save-dev
INFO [karma]: Karma v0.10.2 server started at http://localhost:9018/
WARN [launcher]: Can not load "PhantomJS", it is not registered!
Perhaps you are missing some plugin?
Getting this error. When running npm install karma-phantomjs --save-dev I get an error.
npm ERR! 404 'karma-phantomjs' is not in the npm registry.
I installed karma-phantomjs-launcher --save-dev but i still get an error when running grunt watch.
Anyone else run into this issue?
npm install karma-jasmine --save-dev
npm install karma-phantomjs-launcher --save-dev
Then add the following line to karma.config.js
plugins : ['karma-jasmine', 'karma-phantomjs-launcher']
I got tripped up by this today running
karma: 0.13.7
karma-phantomjs-launcher: 1.0.0
What isn't very obvious is that the launcher has a dependency on:
phantomjs-prebuilt
So if you, install this locally everything should run fine, eg:
npm install phantomjs-prebuilt --save-dev
After some research I realized that I needed to run:
npm install -g karma#canary phantomjs karma-phantomjs-launcher
Once I ran that I went back into my karma-unit.tpl.js file and instead of karma-phantomjs, I changed this to karma-phantomjs-launcher.
Now when I execute a command like grunt build, I get no error regarding phantomJS
This is an issue still open on the repo: #31
Strangely enough the following worked for my Debian based system:
apt-get install libfontconfig
How did I get into this? Reading a comment from the ticket. Hope this will help for others too :-)
I'm running in a CentOS 7 Docker container. Had similar issue.
Had to:
yum install -y tar bzip2 freetype fontconfig
Then
npm install phantomjs --save-dev
worked without errors, which allowed
npm install karma-phantomjs-launcher --save-dev
and that allowed
gulp test
to run without Karma or PhantomJS errors.
Today I had the same. I deleted all the temporary directories and, after rerun it worked.
Before that i also reinstalled phantomjs but without success. It's possible that this influenced, anyway (but i think deleting the temporary directories did the job). Anyway, after deleting temporary folders you can try, if it didn't work you can reinstall phantomjs and also other stuff as other users already wrote.