Angular2应用node-sass安装错误

时间:2017-11-20 15:53:52

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

我的应用程序运行正常,但是当我尝试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。只有在此之后,我才会收到此错误。

任何人都可以帮助我,我在这里做错了吗?

由于

1 个答案:

答案 0 :(得分:0)

我已经面对并修复了此问题与node-sass和python错误有关。尝试使用以下步骤安装最新的angular cli命令

也设置系统变量路径:

C:\用户\ windowsusername \应用程序数据\漫游\ NPM

C:\用户\ windowsusername \应用程序数据\漫游\ NPM \ node_modules \ @angular \ CLI \仓;

C:\ Program Files \ nodejs;

然后使用:

开始使用angular cli命令提示符

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

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