Installing scss-lint with npm without Python - npm

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.

Related

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

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

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.

electron install error : Generated checksum for "electron-v2.0.2-win32-x64.zip" did not match expected checksum

I want to install latest electron version in my existing angular application.So I followed npm command to install it.
Command : npm i electron#latest
Expected Behavior
Electron should installed successfully.
Actual Behavior
So, Whenever I tried to install electron, after downloading zip file and SAMSUN.txt file , it is throwing below error....
Error: Generated checksum for "electron-v2.0.2-win32-x64.zip" did not match expected checksum.
at ChecksumMismatchError.ErrorWithFilename (E:\CityLawElectron\node_modules\electron-download\node_modules\sumchecker\build.js:41:124)
at new ChecksumMismatchError (E:\CityLawElectron\node_modules\electron-download\node_modules\sumchecker\build.js:56:133)
at Hash. (E:\CityLawElectron\node_modules\electron-download\node_modules\sumchecker\build.js:203:22)
at emitNone (events.js:106:13)
at Hash.emit (events.js:208:7)
at emitReadable_ (_stream_readable.js:513:10)
at emitReadable (_stream_readable.js:507:7)
at addChunk (_stream_readable.js:274:7)
at readableAddChunk (_stream_readable.js:250:11)
at Hash.Readable.push (_stream_readable.js:208:10)
Please note that I have tried to clear my npm cache using npm cache clean --force command and tried to install. but it didn't work.
I also tried to install electron globally using npm i -g electron#latest, but that approach also didn't work.
Please provide solution as soon as possible because I m really stuck at this problem.
Electron Version: 2.0.2
Operating System : windows
node version : 8.11.2
npm version : 6.1.0
Last known working Electron version:
We can solve this issue by using following steps (OS - Windows 10)
Delete "SHASUMS256.txt-x.x.xx" file from "C:\Users{{UserName}}.electron".
Delete Cache folder from "C:\Users{{UserName}}\AppData\Local\electron".
Delete electron from node_modules folder.
Then install electron globally and locally by using following commands -
npm init -y //Note: The -y flag provides default options automatically
npm install electron -g //install electron globally
npm install electron --save-dev --save-exact //install electron as devdependencies
If you are using typescript then install it as global using below command-
npm install -g typescript
Above steps may help you.

Installing node.js packages for different architecture

I need to install npm packages that are for a different target architecture (Linux x64) than the machine I am running npm from (Windows x86). Is there a way to tell npm install to download packages that are for the other OS/architecture?
Most native node modules use node-pre-gyp which uses an install script to search for pre-built binaries for your OS/arch/v8 ABI combination, and fallback to native build if one is not available.
Assuming your native modules use node-pre-gyp, you can do this:
npm i --target_arch=x64 --target_platform=linux
You'll see something like this in the output:
> bcrypt#1.0.3 install /home/user/myProject/node_modules/bcrypt
> node-pre-gyp install --fallback-to-build
[bcrypt] Success: "/home/user/myProject/node_modules/bcrypt/lib/binding/bcrypt_lib.node" is installed via remote
If it can't find a prebuilt binary, node-pre-gyp will fall back to attempting to build the module from source.
If the prebuilt modules aren't downloadable, there's also a way to build & host them from your own mirror, but that's a different question :)
Most binary npm packages compile the .node binary from source. You can't really force cross-compilation with npm, but you can possibly create a postinstall script to recompile the particular dependency that re-runs node-gyp with an --arch flag:
"postinstall" : "node-gyp -C node_modules/your-dependency clean configure --arch=x86_64 rebuild"
You will need a proper compiler toolchain. I'm sot sure what it is for windows, but probably you'll end up using mingw or cygwin
In case the package is electron, you can by
npm install --arch=x64 electron
or
export npm_config_arch=x64
npm install --arch=x64 electron
as described on https://www.electronjs.org/docs/latest/tutorial/installation.
These are options of the electron-download package which downloads the actual binary. So they will work only for electron.