【问题标题】:Angular2 applicatoin node-sass install errorAngular2 applicatoin node-sass安装错误
【发布时间】:2017-11-20 15:53:51
【问题描述】:

我的应用程序运行良好,但是当我尝试 npm i 时突然显示以下错误。我的节点版本是:v6.10.3 和 npm 版本:3.10.10

npm WARN prefer global node-gyp@3.6.2 should be installed with -g

> node-sass@4.7.1 install C:\Projects\Latest_Nov20\FrontEnd\OdyssEY-UI-Core\node_modules\node-sass
> node scripts/install.js

gyp info it worked if it ends with ok
gyp verb cli [ 'C:\\Program Files\\nodejs\\node.exe',
gyp verb cli   'C:\\Users\\2024522\\AppData\\Roaming\\npm\\node_modules\\node-sass\\node_modules\\node-gyp\\bin\\node-gyp.js',
gyp verb cli   'rebuild',
gyp verb cli   '--verbose',
gyp verb cli   '--libsass_ext=',
gyp verb cli   '--libsass_cflags=',
gyp verb cli   '--libsass_ldflags=',
gyp verb cli   '--libsass_library=' ]
gyp info using node-gyp@3.6.2
gyp info using node@6.10.3 | win32 | x64
gyp verb command rebuild []
gyp verb command clean []
gyp verb clean removing "build" directory
gyp verb command configure []
gyp verb check python checking for Python executable "python2" in the PATH
gyp verb `which` failed Error: not found: python2
gyp verb `which` failed     at getNotFoundError (C:\Users\2024522\AppData\Roaming\npm\node_modules\node-sass\node_modules\which\which.js:13:12)
gyp verb `which` failed     at F (C:\Users\2024522\AppData\Roaming\npm\node_modules\node-sass\node_modules\which\which.js:68:19)
gyp verb `which` failed     at E (C:\Users\2024522\AppData\Roaming\npm\node_modules\node-sass\node_modules\which\which.js:80:29)
gyp verb `which` failed     at C:\Users\2024522\AppData\Roaming\npm\node_modules\node-sass\node_modules\which\which.js:89:16
gyp verb `which` failed     at C:\Users\2024522\AppData\Roaming\npm\node_modules\node-sass\node_modules\isexe\index.js:42:5
gyp verb `which` failed     at C:\Users\2024522\AppData\Roaming\npm\node_modules\node-sass\node_modules\isexe\windows.js:36:5
gyp verb `which` failed     at FSReqWrap.oncomplete (fs.js:123:15)
gyp verb `which` failed  python2 { Error: not found: python2


Downloading binary from https://github.com/sass/node-sass/releases/download/v4.7.1/win32-x64-48_binding.node
Cannot download "https://github.com/sass/node-sass/releases/download/v4.7.1/win32-x64-48_binding.node":

tunneling socket could not be established, cause=getaddrinfo ENOTFOUND empweb2.ey.net empweb2.ey.net:80

Hint: If github.com is not accessible in your location
      try setting a proxy via HTTP_PROXY, e.g.

      export HTTP_PROXY=http://example.com:1234

or configure npm proxy via

      npm config set proxy http://example.com:8080

> node-sass@4.7.1 postinstall C:\Projects\Latest_Nov20\FrontEnd\OdyssEY-UI-Core\node_modules\node-sass
> node scripts/build.js

我正在尝试安装 nvm 并卸载了 nvm。只有在此之后,我才收到此错误。

谁能帮我在这里做错了什么?

谢谢

【问题讨论】:

    标签: node.js npm-install node-sass


    【解决方案1】:

    我已经遇到并解决了这个与 node-sass 和 python 错误相关的问题。尝试按照以下步骤安装最新的 angular cli 命令

    同时设置系统变量路径:

    C:\Users\windowsusername\AppData\Roaming\npm

    C:\Users\windowsusername\AppData\Roaming\npm\node_modules\@angular\cli\bin;

    C:\Program Files\nodejs;

    然后开始使用 angular cli 命令提示符:

    angular 客户端项目文件夹路径>npm install -g @angular/cli@latest

    angular 客户端项目文件夹路径>npm install -g node-gyp

    【讨论】: