npm run fails because IntelliJ can't find npm even though it is installed - intellij-idea

On my windows 10, in my build.sbt in Intellij IDE, I have a function def runDevBuild(implicit dir: File): Int = ifUiInstalled(runScript("npm run build")). When I run it, I get error 'npm' is not recognized as an internal or external command, operable program or batch file.. npm is installed and I have added it in the PATH variable.
C:\Users\surface>where npm
C:\Program Files\nodejs\npm
C:\Program Files\nodejs\npm.cmd
I have also added paths to npm and node in Intellij settings.
Why is the script not running?

It seems the issue was that I had to restart the IntelliJ IDE. Enterinng node and npm in IntelliJ seem to have worked

delete the node_modules from your directory.use git bash run this command
npm -i -g

Related

Visual Studio Code - NPM not found when using NPM SCRIPTS

If I open the integrated terminal and run npm -v it works.
But, if I running it directly from NPM SCRIPTS it doesn't work.
MORE DETAIL AS REQUESTED IN COMMENT
// Edit by Fogmeister
I also have this problem, here is some more detail...
I have a test script defined in package.json...
When I run this script from the root folder command line using npm run test it works...
This script appears in the list of NPM Scripts in VS Code...
When I run from the NPM Scripts explorer it fails...
Even though it says it is running from the same folder.
Try doing, use dnf or apt-get
sudo apt-get/dnf install npm
The npm file should be in /usr/local/bin/npm. If it's not there, install node.js again with the package on their website.

Changing PATH for npm node_modules

I've been troubleshooting problems with using npm packages for about 2 weeks now. Any node modules (I've tried gulp, gulp-cli, mocha, react, babel, and others) return a "command not found" error in Git Bash.
I have Windows 7 Professional, Node 8.11.1 (64-bit), npm 5.6.0.
What I have tried already is:
In the case of gulp-cli for Lecture 11 of this course
-- Uninstalling the package globally and reinstalling globally
-- Uninstalling and re-installing Node and npm completely
-- Changing the PATH and NODE_PATH of the Environment Variables
User variables
PATH:C:\Program Files\Git\usr\local\node_modules\;C:\Users\Millionaire\AppData\Roaming\npm;
System variables
PATH: C:\Program Files\Git\usr\local\node_modules\;%USERPROFILE%\AppData\Roaming\npm;
$ which node
/c/Program Files/nodejs/node
$which npm
/c/Program Files/nodejs/npm
$ npm list -g
C:\Program Files\Git\usr\local
Any help you can offer is very much appreciated!
I tried a few times to do
$npm list-g {package name}
for gulp and http-server and others and it kept giving me
C:\Program Files\Git\usr\local
So I added that to the system PATH environment variable. Exited and restarted Git Bash and it finally worked for me. Hallelujah.

Installing scss-lint with npm without Python

I'm trying to get gulp-scss-lint to work on my machine, but having trouble doing so.
Context
I have a feeling specific versions and environment settings may be important to my issue, so let me list my specific context:
Windows Server 2012 R2 Standard
NPM 2.14.7
Node 4.2.2
Gulp 3.9.0 installed -g
Running from Powershell 4.0
Repro
Here's a repro of my problem:
mkdir gulpscsslint and cd gulpscsslint
npm init with all default answers
npm install gulp --save-dev
npm install gulp-scss-lint --save-dev
new-item -itemtype file gulpfile.js and enter:
var gulp = require('gulp'), lint = require('gulp-scss-lint');
gulp.task('default', [], function() {
return gulp.src('*.scss').pipe(lint());
});
new-item -itemtype file styles.scss
gulp
Result:
[08:48:50] Using gulpfile ~\experiments\gulpscsslint\gulpfile.js
[08:48:50] Starting 'default'...
[08:48:50] 'default' errored after 32 ms
[08:48:50] Error in plugin 'gulp-scss-lint'
Message:
Error code 1
Error: Command failed: C:\Windows\system32\cmd.exe /s /c "scss-lint 'styles.scss' --format=JSON"
'scss-lint' is not recognized as an internal or external command,
operable program or batch file.
Expected result was obviously actual output from the linter.
So then I continued:
npm install scss-lint --save-dev
But it fails with failNoPython, with this snippet from the output:
Can not download file from https://raw.githubusercontent.com/sass/node-sass-binaries/v2.1.1/win32-x64-node-4.2/binding.node
gyp ERR! configure error
gyp ERR! stack Error: Can't find Python executable "python", you can set the PYTHON env variable
Question
Is it really a hard requirement to have Python to install this Node package? Or can it somehow be installed without installing Python?
As a footnote, now that I've fully written this question I realize this might be more something of a Github issue, but if so I might need some help (learning how to) find(ing) out what package or tool is giving me trouble (gulp-scss-lint? scss-lint? npm? node-sass or some other underlying package?).
You can manually install the package by cloning or downloading it directly from it's github repository and placing it into your targeted location.
Note:
node-gyp is a cross-platform command-line tool written in Node.js for compiling native addon modules for Node.js. Link
This package requires Python to work. Hundreds of packages, including npm and npminstall, rely on node-gyp to compile. On windows, a person can install the package windows-build-tools, which includes python, to use node-gyp.

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.

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

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.