最近,我无论如何都可以告诉我,严格的sass任务的gulp编译时间变得极其缓慢.他们现在每次编译平均大约18-20秒,这是非常缓慢的.我尝试从ruby-sass切换到node-sass,但是node-sass似乎不支持几乎任何我需要的3.3 sass语法(特别是map).在他们全部在ms范围之前; 我永远不会记得他们超过1秒.
这是我的sass任务文件:
var gulp = require('gulp');
var sass = require('gulp-ruby-sass');
var autoprefixer = require('gulp-autoprefixer');
var minifycss = require('gulp-minify-css');
var notify = require('gulp-notify');
var rename = require('gulp-rename');
var handleErrors = require('../util/handleErrors');
var browserSync = require('browser-sync');
gulp.task('styl', function() {
return gulp.src('styl/src/screen.scss')
.pipe(sass({sourcemap: false, style: 'compact'}))
.pipe(autoprefixer('last 2 version', 'safari 5', 'ie 8', 'ie 9', 'opera 12.1', 'ios 6', 'android 4'))
.pipe(gulp.dest('styl/bld'))
.pipe(rename({suffix: '.min'}))
.pipe(minifycss())
.pipe(gulp.dest('../bld'))
.pipe(notify({ message: 'Styles task complete' }))
.pipe(browserSync.reload({ stream: true, notify: false }))
.on('error', …Run Code Online (Sandbox Code Playgroud) 我使用 Node 制作了一个应用程序,并尝试使用 AWS 的 Elastic Beanstalk 来托管它,但是当它到达 node-sass 时,它总是无法安装 npm。这是日志中的错误:
5162 错误 node-sass@4.5.0 安装后:
node scripts/build.js5162 错误退出状态 1 5163 错误 node-sass@4.5.0 安装后脚本“节点脚本/build.js”失败。5163 错误确保您安装了最新版本的 node.js 和 npm。5163 错误如果你这样做了,这很可能是 node-sass 包的问题,5163 错误不是 npm 本身的问题。5163 错误 告诉作者这在您的系统上失败了: 5163 错误 node scripts/build.js 5163 错误 您可以通过以下方式获取有关如何为此项目打开问题的信息: 5163 错误 npm bugs node-sass 5163 错误 或者如果不是不可用,您可以通过以下方式获取他们的信息: 5163 error npm owner ls node-sass 5163 error 上面可能有额外的日志输出。5164 详细退出 [1, true]
这是我的存储库:https : //github.com/Jacob-Elder/react-socket.io-messaging
我搜索了这个问题,发现有些人用“--unsafe-perm”标志重新安装了 node-sass,但这似乎不是权限问题。我是 AWS 和编码新手,因此非常感谢任何帮助!
sass amazon-web-services node.js node-sass amazon-elastic-beanstalk
node-sass@2.1.1 install /home/user/Documents/project/node_modules/node-sass
> node scripts/install.js
WARN invalid config loglevel="notice"
Can not download file from https://raw.githubusercontent.com/sass/node-sass-binaries/v2.1.1/linux-x64-node-8.2/binding.node
> node-sass@2.1.1 postinstall /home/user/Documents/project/node_modules/node-sass
> node scripts/build.js
module.js:487
throw err;
^
Error: Cannot find module '/home/user/Documents/project/node_modules/node-sass/node_modules/pangyp/bin/node-gyp'
at Function.Module._resolveFilename (module.js:485:15)
at Function.Module._load (module.js:437:25)
at Function.Module.runMain (module.js:605:10)
at startup (bootstrap_node.js:158:16)
at bootstrap_node.js:575:3
Build failed
added 2186 packages in 42.166s
Run Code Online (Sandbox Code Playgroud)
我到目前为止尝试过:
更新brew并重新安装node后,设置依赖时出现错误。告诉我如何解决这个问题?
下面的代码不是全部错误,因为字符数有限制,所以只有一部分。
节点 v10.2.1
PHP 7.2.6 (cli)(构建时间:2018 年 5 月 25 日 06:18:43)(NTS)
Python 2.7.10(默认,2017 年 10 月 6 日,22:29:07)
? yarn install --save-dev
yarn install v0.15.1
warning frontend_pack@1.0.0: No license field
warning frontend_pack@1.0.0: Dependency "path" listed in "devDependencies" is the name of a built-in module
[1/4] Resolving packages...
[2/4] Fetching packages...
warning lodash@1.0.2: The engine "rhino" appears to be invalid.
[3/4] Linking dependencies...
warning Unmet peer dependency "jquery@>=1.9.0".
[4/4] Building fresh packages...
[1/1] ? node-sass: not ok
[-/1] ? …Run Code Online (Sandbox Code Playgroud) 我在 ionic v4 中创建了项目,但在 ./src/global.scss 中出现错误,请参阅下面的错误
>ERROR in ./src/global.scss (./node_modules/@angular-devkit/build-angular/src/angular-cli-files/plugins/raw-css-loader.js!./node_modules/postcss-loader/src??embedded!./node_modules/sass-loader/lib/loader.js??ref--14-3!./src/global.scss)
[ng] Module build failed (from ./node_modules/sass-loader/lib/loader.js):
[ng] Error: Cannot find module 'node-sass'
[ng] at Function.Module._resolveFilename (internal/modules/cjs/loader.js:581:15)
[ng] at Function.Module._load (internal/modules/cjs/loader.js:507:25)
[ng] at Module.require (internal/modules/cjs/loader.js:637:17)
[ng] at require (internal/modules/cjs/helpers.js:22:18)
[ng] at Object.sassLoader (/home/manish/newionic_workspace/latest100days/node_modules/sass-loader/lib/loader.js:46:72)
[ng] ERROR in ./src/theme/variables.scss (./node_modules/@angular-devkit/build-angular/src/angular-cli-files/plugins/raw-css-loader.js!./node_modules/postcss-loader/src??embedded!./node_modules/sass-loader/lib/loader.js??ref--14-3!./src/theme/variables.scss)
[ng] Module build failed (from ./node_modules/sass-loader/lib/loader.js):
[ng] Error: Cannot find module 'node-sass'
[ng] at Function.Module._resolveFilename (internal/modules/cjs/loader.js:581:15)
[ng] at Function.Module._load (internal/modules/cjs/loader.js:507:25)
[ng] at Module.require (internal/modules/cjs/loader.js:637:17)
[ng] at require (internal/modules/cjs/helpers.js:22:18)
[ng] at Object.sassLoader (/home/manish/newionic_workspace
/latest100days/node_modules/sass-loader/lib/loader.js:46:72) …Run Code Online (Sandbox Code Playgroud) 我们是一个致力于 angular 项目的团队。从 repo 下载代码后,当我尝试运行 $npm install 时,我面临以下错误。
我尝试在项目目录下安装 node-gyp、node-sass、删除的 node_modules,但在执行 $npm install 时没有解决问题
../src/create_string.cpp: 在函数 'char* create_string(Nan::MaybeLocal)': ../src/create_string.cpp:17:37: 错误:没有匹配的函数调用 v8::String:: Utf8Value::Utf8Value(v8::Local&)' v8::String::Utf8Value string(value); ^
在 /home/pc-username/.node-gyp/12.7.0/include/node/node.h:63:0 包含的文件中,
Run Code Online (Sandbox Code Playgroud)from ../../../../../nan/nan.h:54, from ../src/create_string.cpp:1: /home/pc-username/.node-gyp/12.7.0/include/node/v8.h:3002:5: note: candidate: v8::String::Utf8Value::Utf8Value(v8::Isolate*, v8::Local<v8::Value>) Utf8Value(Isolate* isolate, Local<v8::Value> obj); ^~~~~~~~~/home/pc-username/.node-gyp/12.7.0/include/node/v8.h:3002:5: 注意:候选人需要 2 个参数,1 个提供 binding.target.mk:127: 目标 'Release 的配方/obj.target/binding/src/create_string.o' 失败
Run Code Online (Sandbox Code Playgroud)make: *** [Release/obj.target/binding/src/create_string.o] Error 1 make: Leaving directory '/home/pc-username/project-folder/project-name/node_modules/@angular-devkit/build-angular/node_modules/node-sass/build' gyp ERR! build error gyp ERR! stack Error: `make` failed with exit code: 2 gyp ERR! stack at ChildProcess.onExit …
错误:Node Sass 尚不支持您当前的环境:Linux 64-bit with Unsupported runtime (72)
我在使用最新版本的 node.js 时遇到了这个问题,即 12.6.0 和 npm 版本 6.9.0。
哪个版本的 node-sass 与上述 node 和 npm 版本兼容。
节点 sass 版本:4.5.3
我第一次尝试在新的 .Net Core 3.1 Web 应用程序上设置 grunt-sass。我已经通过MSFT的步骤去咕噜添加到这里列出一个项目在这里,然后从咕噜-萨斯指示的步骤修改了它在这里。
然而,这会导致任务运行器资源管理器声明没有找到任务。这是我的 package.json:
{
"name": "chapelstudios_www",
"version": "0.0.2",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "git+https://me@bitbucket.org/me/chapelstudios_www.git"
},
"author": "mr",
"license": "ISC",
"homepage": "https://bitbucket.org/me/chapelstudios_www#readme",
"private": true,
"devDependencies": {
"grunt": "^1.0.4",
"grunt-cli": "^1.3.2",
"grunt-sass": "^3.1.0",
"node-sass": "^4.13.1"
},
"dependencies": {
"gulp": "^4.0.2"
}
}
Run Code Online (Sandbox Code Playgroud)
这是我的 gruntfile.js:
const sass = require('node-sass');
require('load-grunt-tasks')(grunt);
module.exports = function (grunt) {
// Project …Run Code Online (Sandbox Code Playgroud) gruntjs node-sass grunt-sass-lint visual-studio-2019 .net-core-3.1
在 Ubuntu 21.10 上,实际上没有安装 Python2.x,在大型项目上执行“npm install”时,我遇到以下错误(很大,package.json但这两行可能相关:
...
"devDependencies": {
...
"sass": "^1.46.0",
"sass-loader": "10.1.1",
...
Run Code Online (Sandbox Code Playgroud)
)
$ npm install
npm ERR! code 1
npm ERR! git dep preparation failed
npm ERR! command /usr/bin/node /usr/lib/node_modules/npm/bin/npm-cli.js install --force --cache=/home/username/.npm --prefer-offline=false --prefer-online=false --offline=false --no-progress --no-save --no-audit --include=dev --include=peer --include=optional --no-package-lock-only --no-dry-run
npm ERR! npm WARN using --force Recommended protections disabled.
npm ERR! npm WARN old lockfile
npm ERR! npm WARN old lockfile The package-lock.json file was created with an old version …Run Code Online (Sandbox Code Playgroud) 在删除项目中的所有错误后,我从 Angular 7 更新到 Angular 14,这是阻止我成功编译的唯一错误。我在 ng 服务上收到此错误:
/src/app/shared/styles/themes/theme-f.scss:1:6 - 错误:模块解析失败:意外的标记 (1:6) 文件已使用这些加载器处理:*/node_modules/resolve-url-loader /index.js */node_modules/sass-loader/dist/cjs.js 您可能需要一个额外的加载器来处理这些加载器的结果。正文,.wrapper > 部分 { | 背景颜色:#f5f7fa;| 颜色:#73879C;
这是我的 tsconfig.json 文件
{
"compileOnSave": false,
"compilerOptions": {
"strictPropertyInitialization": false,
"baseUrl": "./",
"outDir": "./dist/out-tsc",
"sourceMap": true,
"declaration": false,
"module": "es2020",
"moduleResolution": "node",
"experimentalDecorators": true,
"importHelpers": true,
"target": "es2019",
"skipLibCheck": true,
"typeRoots": [
"node_modules/@types"
],
"types": [ "googlemaps" ],
"lib": [
"es2018",
"DOM",
"DOM.Iterable",
//"ScriptHost"
]
},
"angularCompilerOptions": {
//"enableLegacyTemplate": true,
//"enableI18nLegacyMessageIdFormat": false,
"disableTypeScriptVersionCheck": true,
"strictInjectionParameters": true,
"strictInputAccessModifiers": true, …Run Code Online (Sandbox Code Playgroud)