【问题标题】:Problem when running sass after installation安装后运行sass时出现问题
【发布时间】:2021-02-20 20:38:03
【问题描述】:

问题

我正在尝试将 sass 作为我正在学习的课程的一部分。但是,当输入以下命令时:

PS H:\Qubo\LEARNING\HTML & CSS\CSS\sass_sandbox> npm run sass

我明白了:

> node-sass -w scss/ -o dist/css/ --recursive

'CSS\CSS\sass_sandbox\node_modules\.bin\' is not recognized as an internal or external command,
operable program or batch file.
internal/modules/cjs/loader.js:883
  throw err;
  ^

Error: Cannot find module 'H:\Qubo\LEARNING\node-sass\bin\node-sass'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:880:15)
    at Function.Module._load (internal/modules/cjs/loader.js:725:27)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12)
    at internal/main/run_main_module.js:17:47 {
  code: 'MODULE_NOT_FOUND',
  requireStack: []
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! sass_sandbox@1.0.0 sass: `node-sass -w scss/ -o dist/css/ --recursive`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the sass_sandbox@1.0.0 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!     C:\Users\My Name\AppData\Roaming\npm-cache\_logs\2020-11-08T20_44_40_258Z-debug.log```

【问题讨论】:

  • 如果你有 node sass 作为依赖,运行 npm i 或者运行 npm i -g node-sass 再试一次
  • 谁能帮我解决这个问题?我很感激,谢谢。 J
  • 当你按照我的建议去做时发生了什么?
  • 对不起,Dominik,我在看到您的评论之前发表了我的评论。我现在试试
  • 我都试过了,都没有用

标签: node.js nodes node-modules


【解决方案1】:

我找到了解决问题的方法,尽管我不知道它是如何工作的。

解决方案:

  1. 查看代码,我注意到它在查找文件夹时出现问题,该文件夹不在该文件夹中。
  2. 当我的文件夹位于 H(单独的硬盘驱动器)时,它正在查找“C”。
  3. 我将它移到桌面(在“C”内),然后很快就成功了。

【讨论】:

    猜你喜欢
    • 2021-07-04
    • 1970-01-01
    • 2020-10-19
    • 1970-01-01
    • 2023-03-14
    • 2015-05-20
    • 1970-01-01
    • 2022-10-19
    • 1970-01-01
    相关资源
    最近更新 更多