【问题标题】:Node-sass script does no longer work and I can't find the reason whyNode-sass 脚本不再起作用,我找不到原因
【发布时间】:2019-09-02 20:16:54
【问题描述】:

我不能再使用我的 compile:sass 脚本

" "compile:sass": "node-sass sass/main.scss css/style.css -w" " 因为我一运行就收到错误。在我重新启动 Visual Studio Code 之前它运行良好。我只是将主文件夹名称从 Natours-1 更改为 Natours_1,以便我的 Creative Cloud 文件夹可以同步,但这应该不是问题吧?

我刚开始学习 sass 和 node,所以这可能是一个菜鸟问题!

我已经尝试重新安装 sass 并检查了 package.json 和 main.scss 是否存在我没​​有发现的缺陷!

错误信息:

> node-sass sass/main.scss css/style.css -w

/Users/basgroep/Creative Cloud Files/Development/1_Natours/node_modules/scss-tokenizer/lib/tokenize.js:265
                if (ident.test(css) && (ident.lastIndex = pos || 1) && ident.exec(css).index === pos) {
                                                                                      ^

TypeError: Cannot read property 'index' of null
    at tokenize (/Users/basgroep/Creative Cloud Files/Development/1_Natours/node_modules/scss-tokenizer/lib/tokenize.js:265:87)
    at Object.scss.tokenize (/Users/basgroep/Creative Cloud Files/Development/1_Natours/node_modules/scss-tokenizer/lib/entry.js:18:35)
    at parseImports (/Users/basgroep/Creative Cloud Files/Development/1_Natours/node_modules/sass-graph/parse-imports.js:4:26)
    at Graph.addFile (/Users/basgroep/Creative Cloud Files/Development/1_Natours/node_modules/sass-graph/sass-graph.js:69:17)
    at Graph.addFile (/Users/basgroep/Creative Cloud Files/Development/1_Natours/node_modules/sass-graph/sass-graph.js:81:12)
    at Object.module.exports.parseFile (/Users/basgroep/Creative Cloud Files/Development/1_Natours/node_modules/sass-graph/sass-graph.js:146:11)
    at Object.watcher.reset (/Users/basgroep/Creative Cloud Files/Development/1_Natours/node_modules/node-sass/lib/watcher.js:19:21)
    at watch (/Users/basgroep/Creative Cloud Files/Development/1_Natours/node_modules/node-sass/bin/node-sass:260:20)
    at run (/Users/basgroep/Creative Cloud Files/Development/1_Natours/node_modules/node-sass/bin/node-sass:319:5)
    at Object.<anonymous> (/Users/basgroep/Creative Cloud Files/Development/1_Natours/node_modules/node-sass/bin/node-sass:405:3)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! natours@1.0.0 compile:sass: `node-sass sass/main.scss css/style.css -w`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the natours@1.0.0 compile:sass script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/basgroep/.npm/_logs/2019-09-02T08_57_21_368Z-debug.log
The terminal process terminated with exit code: 1

【问题讨论】:

    标签: sass node-modules


    【解决方案1】:

    你可以使用下面的命令

    npm rebuild node-sass
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2012-03-06
      • 2023-03-24
      • 1970-01-01
      • 1970-01-01
      • 2022-06-16
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多