Error with gulp-sass - npm

I get the following error when trying to run 'gulp serve':
[14:14:52] Plumber found unhandled error:
Error in plugin 'gulp-sass'
Message:
#import directives are not allowed inside mixins and functions
Details:
fileName: ./bower_components/bootswatch/spacelab/_bootswatch.scss
lineNumber: 8
I upgraded to the latest node version. Ran "npm rebuild node-sass" and "npm rebuild gulp-sass". I tried reinstalling bower packages and npm packages. Is there any sort of assumption I can make. I can try to reinstall npm packages by hand, but there is about 50 and I am afraid it won't do anything.
Any pointers welcome. Will be here until I solve this. 'npm gulp-sass version' gives the same version as my team has and build works for all of them.

I checked the original source of the Bower component you included and saw the following happening on the line mentioned there:
#mixin web-font($path){
#import url("#{$path}");
}
As far as I know, "imports" are not allowed in libsass (which is the base for gulp-sass), as it would be a conditional import (which isn't allowed for various reasons) and could lead to possible errors. Ruby Sass is a little more forgiving there.
You might want use a different Bootswatch package there (like bootswatch-sass).

Related

npx from command line does not find imports?

I'm trying to run a simple hello.ts script from command line. This works if the script has no dependencies:
npx ts-node hello.ts
But as soon as I start adding some dependencies...
import _ from 'lodash';
console.log('hello');
It fails:
Cannot find module 'lodash' or its corresponding type declarations.
It keeps failing even if I install the dependencies globally. So how do I tell npx (or ts-node for that matter) to consider globally installed dependencies?
Update
Using Node 16.9.1 (upgraded via Version Lens). The error seems to have disappeared after uninstalling/reinstalling the imported libraries a few times.
If you're using npm >=1.0, you can use npm link to create a local link to a package already installed globally. (Caveat: The OS must support symlinks.)
IE: npm install -g lodash && npm link lodash
However, this doesn't come without its problems.
npm link is a development tool. It's awesome for managing packages on your local development box. But deploying with npm link is basically asking for problems, since it makes it super easy to update things without realizing it.
As an alternative, you can install the packages locally as well as globally.
For additional information, see:
https://nodejs.org/en/blog/npm/npm-1-0-link/
https://nodejs.org/en/blog/npm/npm-1-0-global-vs-local-installation/
Are you using the n package by any chance? I used n to change from a newer version of node (16.2.0) to an older version of node (12.13.0), ran npm i and npx failed with a different error.
Using n to change back to 16.2.0 seems to have resolved the issue so I'm thinking perhaps it was an issue with package-lock.json or such

Browserify cannot find xxx from yyy

I am using a plugin called tabulator: http://tabulator.info/docs/4.0/quickstart
Here it is described how to install and require it:
npm install tabulator-tables --save
var Tabulator = require('tabulator-tables');
This I have done, so far so good.
I put the require statement in a seperate js file called main.js
Then in order to be able to use require, I use browserify:
C:\SRC\cars\CARS\node_modules>browserify main.js -o bundle.js
Now I get an error:
Error: Cannot find module 'tabulator-tables' from 'C:\SRC\cars\CARS\node_modules'
at C:\Users\john\AppData\Roaming\npm\node_modules\browserify\node_modules\browser-resolve\node_modules\resolve\lib\async.js:46:17
And I simply cannot understand what I am doing wrong!
Can anyone help me out with this?
There was an issue with the 4.0.2 release over the weekend that accidentally removed the dist directory and is what is causing your problems. if you update to the 4.0.4 release your issue should be fixed
npm update tabulator-tables

NPM deprecated package makes install fail

I am struggling to understand why trying to run a npm install fails when one of the packages in the list is deprecated. A warning shouldn't make the command fail, shouldn't it?
I found the culprit PR. They created a version that hard breaks..
https://github.com/aspnet/SignalR/pull/2057
Got to love MS..

Where does npm store module when loading directly from github?

I have found a react-native module I would like to use. It contains an error which prohibits the installation.
I have forked the repository and corrected the mistake.
Now I want to install my module in order to use it, however during execution of the post installation scripts I get an error - file not found.
I have tried to find the reason for it, but the reason is quite simple, the module is not in the node_modules directory, and when npm tries to "enter" there to run the scripts, it can't find them.
I have tried to check where this is installed, but I can't.
I use npm install <user>/<repo> to install my module.

Module not found when using flat-ui with webpack

I want to use flat-ui with webpack when installed with npm. I have created a test project. The last commit is before installing flat-ui. When I do install and use
require('flat-ui');
I get the error:
Module not found: Error: Cannot resolve module 'flat-ui'
In my research I found this gist but am not familiar enough with webpack to understand it well enough.
My goal is to use npm to install dependencies rather than clutter up my project.
'flat-ui' npm package is not official package. This package provides old version. ( issue )
You need to install 'designmodo-flat-ui' package.