我通过 npm 在我的项目中安装了 postcss-cli autoprefixer 和 postcss-flexbugs-fixes 。pff 有未满足的 dep 警告,但它确实安装了。我知道我的 postcss 和 cli 正在工作,因为当我运行时
postcss --use autoprefixer index.scss
Run Code Online (Sandbox Code Playgroud)
从终端它工作得很好 - 我有一些虚拟的 css 在那里无论如何只是为了排除语法错误。
当我跑步时
postcss --use postcss-flexbugs-fixes index.scss
Run Code Online (Sandbox Code Playgroud)
我收到一条错误消息,指出找不到模块 postcss-flexbugs-fixes。可能值得一提的是,我使用的是 Node 4.4.5,但我之前已经在这个版本的 Node 上进行过 postcss-flexbugs-fixes 工作,唯一的区别(包括版本号)是它被包装在 gulp 任务中。这是完整的错误:
Error: Cannot find module 'postcss-flexbugs-fixes'
at Function.Module._resolveFilename (module.js:325:15)
at Function.Module._load (module.js:276:25)
at Module.require (module.js:353:17)
at require (internal/module.js:12:17)
at /Users/ohu275/.nvm/versions/node/v4.4.5/lib/node_modules/postcss-cli/index.js:107:14
at Array.map (native)
at Object.<anonymous> (/Users/ohu275/.nvm/versions/node/v4.4.5/lib/node_modules/postcss-cli/index.js:100:24)
at Module._compile (module.js:409:26)
at Object.Module._extensions..js (module.js:416:10)
at Module.load (module.js:343:32)
Run Code Online (Sandbox Code Playgroud)
我最终试图达到可以通过 npm 构建脚本运行 postcss 任务的地步。我已经有了 autoprefixer 工作,但没有通过 …
我已经为材料设计创建了一个主题,但是当我构建时出现错误。我的代码是这样的:
\n\nmain.scss
@import "~@angular/material/theming";\n\n// Theme variables, must be included before the libraries to allow overriding defaults\n@import "theme/theme-variables";\n\n// Theme customization\n// -------------------\n@import "theme/theme";\nRun Code Online (Sandbox Code Playgroud)\n\ntheme-variables.scss
// Theme contrast color\n$dark: $black-87-opacity;\n$light: $white-87-opacity;\n$strong-light: rgb(255, 255, 255);\n\n// Theme color map\n$theme-blue: (\n 50: #ebf1fa,\n 100: #c2d4ef,\n 200: #9ab8e5,\n 300: #78a0dc,\n 400: #5688d3,\n 500: #3470ca,\n 600: #2e62b1,\n 700: #275498,\n 800: #21467e,\n 900: #1a3865,\n A100: #c2d4ef,\n A200: #9ab8e5,\n A400: #5688d3,\n A700: #275498,\n contrast: (\n 50: $dark,\n 100: $dark,\n 200: $dark,\n 300: $strong-light,\n 400: $strong-light,\n …Run Code Online (Sandbox Code Playgroud) 我正在尝试使用新的 sass 模块系统的功能@use。即使在阅读文档并尝试做同样的事情之后,也无法弄清楚如何正确使用它。这是我尝试过的:
\n\n在Buttons.scss文件中我声明了这些变量
\n\n$border-color: black;\n$color: white;\n$bg: beige;\nRun Code Online (Sandbox Code Playgroud)\n\n这样,在main.scss文件中,我导入Buttons.scss文件并尝试使用Buttons.scss文件具有的变量。
\n\n@use "buttons";\n\n$button-color: buttons.$color;\n$button-bg: buttons.$bg;\n$button-border-color: buttons.$border-color;\n\n.btn{\n color: $button-color;\n border: 1px solid $button-border-color;\n background: $button-bg;\n padding: 8px 12px;\n display: inline-block;\n}\nRun Code Online (Sandbox Code Playgroud)\n\n文件夹结构如下所示
\n\ncss\nsass\n \xe2\x94\xa3 buttons.scss\n \xe2\x94\x97 main.scss\nRun Code Online (Sandbox Code Playgroud)\n\n并且编译时会抛出错误Invalid CSS after \\"...-color: buttons\\。我正在关注这个博客Sass 模块简介。
我该如何@use正确使用?
我一直在尝试使用安装 node-sass
npm i node-sass
但是每当我尝试时都会收到以下错误npm start:
Node Sass version 6.0.0 is incompatible with ^4.0.0 || ^5.0.0.
Run Code Online (Sandbox Code Playgroud)
我什至尝试将 node-sass 降级到 V5.0.0 或 V4.14,但它无法安装!它会卡在最后,当我强制退出时使用ctrl+c,它会输出一个巨大的日志(请告诉我是否可以在此处发布)。
任何帮助,将不胜感激
我尝试安装 sass-loader 来编译 scss,但它显示了一个版本兼容性错误。我降级了版本并做了很多事情,但仍然显示相同的问题。
React 版本 - 17.0.2 节点版本 - 16.2.0 npm 版本 - 7.13.0
包.json
"dependencies": {
"@testing-library/jest-dom": "^5.11.4",
"@testing-library/react": "^11.1.0",
"@testing-library/user-event": "^12.1.10",
"antd": "^4.16.2",
"node-sass": "^4.14.1",
"react": "^17.0.2",
"react-dom": "^17.0.2",
"react-redux": "^7.2.4",
"react-scripts": "4.0.3",
"redux-saga": "^1.1.3",
"web-vitals": "^1.0.1"
},
Run Code Online (Sandbox Code Playgroud)
我第一次尝试在本地运行旧版 React 应用程序。我使用的是装有 Big Sur 11.5.2 的新 Mac M1。我的节点版本是 16.9.0,我将 python3 设置为默认值(尽管该应用程序似乎正在寻找 python2)。我还将 CommandLineTools 升级到了最新版本。
但是当我做一个简单的操作时npm install,我收到很多警告,最后出现这个错误:
npm ERR! /Users/cd/.node-gyp/16.9.0/include/node/v8-internal.h:489:38: error: no template named 'remove_cv_t' in namespace 'std'; did you mean 'remove_cv'?
npm ERR! !std::is_same<Data, std::remove_cv_t<T>>::value>::Perform(data);
npm ERR! ~~~~~^~~~~~~~~~~
npm ERR! remove_cv
npm ERR! /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/type_traits:776:50: note: 'remove_cv' declared here
npm ERR! template <class _Tp> struct _LIBCPP_TEMPLATE_VIS remove_cv
npm ERR! ^
npm ERR! 1 error generated.
npm ERR! make: *** [Release/obj.target/binding/src/binding.o] Error 1
npm ERR! gyp ERR! build error …Run Code Online (Sandbox Code Playgroud) npm install node-sass
npm WARN deprecated har-validator@5.1.5: this library is no longer supported
npm WARN deprecated uuid@3.4.0: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.
npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
npm ERR! code 1
npm ERR! path D:\RND\redux-toolkit\node_modules\node-sass
npm ERR! command failed
npm ERR! command C:\WINDOWS\system32\cmd.exe /d /s /c node scripts/build.js
npm ERR! Building: C:\Program Files\nodejs\node.exe D:\RND\redux-toolkit\node_modules\node-gyp\bin\node-gyp.js rebuild …Run Code Online (Sandbox Code Playgroud) 跑步时
npm install --saveDev node-sass@4.5.3
Run Code Online (Sandbox Code Playgroud)
我收到此错误我尝试了很多方法,例如删除节点模块和 package-lock.json 以及安装 window-builder-tools 以及安装 Cygwin 但似乎没有任何效果请帮助,尽管版本 8 正在工作我认为我需要 4 因为一些需要版本 4 的错误,提前致谢
npm install --saveDev node-sass@4.5.3
Run Code Online (Sandbox Code Playgroud)
我正在尝试构建一个前端服务器,当我运行grunt时,我得到了这个错误,建议重新安装node-sass.
Aborted due to warnings.
dev@ubuntu:~/ideaProjects/web-app$ grunt app:dashboard/dev-dashboard --force
Loading "sass.js" tasks...ERROR
Error: `/home/dev/ideaProjects/web-app/node_modules/grunt-sass/node_modules/node-sass/bin/linux-x64-v8-3.28/binding.node` is missing.
Try reinstalling `node-sass`?
Run Code Online (Sandbox Code Playgroud)
奇怪的是文件(binding.node)确实存在,但它位于名为'linux-x64-v8-3.14'的文件夹中,而不是3.28.我尝试命名不起作用的文件夹3.14.我已经尝试了所有我能解决的问题,npm install node-sass,npm update,甚至清理项目并在新的构建上运行npm install.但无济于事.我反复得到这个错误.
有没有人看过这个或知道如何解决这个问题?我正在运行Ubuntu 14.04 x64
谢谢!
任何调用都会npm run产生此错误:
$ npm run dev
> @ dev /project
> npm run development
> @ development /project
> cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js
/project/node_modules/webpack-cli/bin/cli.js:235
throw err;
^
Error: Cannot find module 'sass'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:603:15)
at Function.Module._load (internal/modules/cjs/loader.js:529:25)
at Module.require (internal/modules/cjs/loader.js:657:17)
at require (/project/node_modules/v8-compile-cache/v8-compile-cache.js:159:20)
at implementation (/project/node_modules/laravel-mix/src/components/Sass.js:52:39)
at implementation (/project/node_modules/laravel-mix/src/components/Preprocessor.js:125:61)
at global.tap (/project/node_modules/laravel-mix/src/helpers.js:10:5)
at Sass.loaderOptions (/project/node_modules/laravel-mix/src/components/Preprocessor.js:123:9)
at extractPlugin (/project/node_modules/laravel-mix/src/components/Preprocessor.js:87:39)
at global.tap (/project/node_modules/laravel-mix/src/helpers.js:10:5)
at details.forEach.preprocessor (/project/node_modules/laravel-mix/src/components/Preprocessor.js:27:13)
at Array.forEach (<anonymous>)
at Sass.webpackRules (/project/node_modules/laravel-mix/src/components/Preprocessor.js:22:22)
at ComponentFactory.applyRules (/project/node_modules/laravel-mix/src/components/ComponentFactory.js:155:23)
at Mix.listen.rules …Run Code Online (Sandbox Code Playgroud) node-sass ×10
node.js ×5
sass ×4
npm ×2
reactjs ×2
angular ×1
css ×1
gruntjs ×1
javascript ×1
laravel-mix ×1
node-modules ×1
npm-install ×1
postcss ×1
sass-loader ×1
ubuntu ×1