Answer the question
In order to leave comments, you need to log in
Why can't Gulp-Sass install on Ubuntu?
Hi all!
I created a project, I connect gulp-sass npm i -D node-sass gulp-sass
, when the task is executed, it displays an error Error: Cannot find module 'node-sass'
. With what it can be connected?
The command npm -v gulp-sass
outputs 6.9.0
. That is, the module exists. It is also available in the folder node_modules
...
The task is the simplest, there are no errors
const
gulp = require('gulp'),
sass = require('gulp-sass');
gulp.task('sass', () => {
return gulp.src('build/sass/to_pages/*.sass')
.pipe(sass({
outputStyle: 'compressed'
}).on('error', sass.logError))
.pipe(gulp.dest('./css'));
});
npm i -D node-sass
- it gave out Error: Cannot find module 'gulp-sass'
npm i -D gulp-sass
and further launch displays information about its absence: Error: Cannot find module 'gulp-sass'
, the node_modules
folder is gulp-sass
empty. Answer the question
In order to leave comments, you need to log in
What if npm update and then npm i gulp-sass ?
And as an option
npm install
Maybe you mean new_arr[j]=arr[i];
?
Just why would it be if you have an array ?
In general, the loop in this case is not the best solution, because there is a sort function that accepts a callback:arr[2]
defined
["world2", "Hello1"]
var arr = ['world2', 'Hello1'];
arr.sort(function(a, b){
return a.replace(/\D/g, '') - b.replace(/\D/g, '');
});
console.log(arr); // ["Hello1", "world2"]
/\D/g
- a regular expression meaning "Not a digit" with the modifier g
- Global, which does not stop after the first match. function order(words){
var arr=words.split(" ");
var new_arr=[];
for(var i=0;i<arr.length;i++){
for(var j=1;j<=9;j++){
if(arr[i].indexOf(j)>-1){
//console.log(i,j,arr[i]);
new_arr[j]=arr[i];
}
}
}
return new_arr.join(" ").substr(1);
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question