【问题标题】:Installing gulp-sass - node is not recognized安装 gulp-sass - 无法识别节点
【发布时间】:2016-01-09 18:19:50
【问题描述】:

我正在使用 nodejs 和 npm 开发应用程序。我有 Windows 10,我正在使用 npm v.3.3.7 和节点 v.4.1.2。

要设置它们,我将执行以下步骤:

  1. 使用 npm 安装 NodeJs
  2. 从 git 下载 Npm-master 3.3.7 并覆盖文件夹 C:\Program Files\nodejs\node_modules\npm
  3. 添加到环境变量 C:\Users\bilias7\AppData\Roaming\npm;C:\Program Files\nodejs;对于当前用户和系统 PATH 变量。

直到这里一切正常,我可以从 CMD 使用 node 和 npm,并且通过提升的 CMD,我可以安装全局包。

当我尝试安装依赖于 node-sass 的 gulp-sass 时,问题就开始了。下面的命令返回一个节点不被识别为内部或外部命令的错误。

npm install -g gulp-sass

你可以在下面的错误中看到安装node-sass包返回的错误。

'node' is not recognized as an internal or external command,
operable program or batch file.
npm WARN install:node-sass@3.3.3 node-sass@3.3.3 install: `node scripts/install.js`
npm WARN install:node-sass@3.3.3 Exit status 1
C:\Program Files\nodejs
└── (empty)

npm ERR! code 1

所以我尝试使用以下命令显式安装 node-sass

npm install -g node-sass

我得到了如下的详细错误。我想 install.js 执行内部出了点问题,它没有与命令节点连接,但我不知道那是什么。

C:\Program Files\nodejs\node-sass -> C:\Program Files\nodejs\node_modules\node-sass\bin\node-sass

> node-sass@3.3.3 install C:\Program Files\nodejs\node_modules\node-sass
> node scripts/install.js

'node' is not recognized as an internal or external command,
operable program or batch file.
npm ERR! Windows_NT 10.0.10240
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "-g" "node-sass"
npm ERR! node v4.1.2
npm ERR! npm  v3.3.7
npm ERR! code ELIFECYCLE

npm ERR! node-sass@3.3.3 install: `node scripts/install.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the node-sass@3.3.3 install script 'node scripts/install.js'.
npm ERR! This is most likely a problem with the node-sass package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node scripts/install.js
npm ERR! You can get their info via:
npm ERR!     npm owner ls node-sass
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     C:\Windows\system32\npm-debug.log

您也可以从here下载完整的日志文件

任何想法都是有帮助和欢迎的,因为我已经花了 20 多个小时了!!

【问题讨论】:

    标签: node.js windows npm gulp-sass node-sass


    【解决方案1】:

    可能 nodejs 没有添加到您的环境变量中。检查 - Node.js doesn't recognize system path?

    【讨论】:

    • 你好@DexTer我已经在我的环境变量中添加了NodeJs,我在这个配置之后重新启动了我的电脑,但没有运气。不管怎样,谢谢你的回答!
    猜你喜欢
    • 1970-01-01
    • 2015-10-12
    • 2018-04-02
    • 2018-08-01
    • 2020-12-01
    • 2020-11-01
    • 2012-04-25
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多