angular安装今天通过npm安装install的时候出现的问题
E:\Workspace_WebStorm\angular2>npm install -g
C:\Users\lyx\AppData\Roaming\npm
`-- angular2@0.0.0
`-- UNMET PEER DEPENDENCY typescript@>=1.8.0 <2.1.0 || >=1.9.0-dev || >=2.0.0-dev || || >=2.1.0-dev
npm WARN ts-helpers@1.1.2 requires a peer of typescript@>=1.8.0 <2.1.0 || >=1.9.0-dev || >=2.0.0-dev || || >=2.1.0-dev but none was installed.
E:\Workspace_WebStorm\angular2>npm install
npm WARN deprecated angular-cli@1.0.0-beta.28.3: angular-cli has been renamed to @angular/cli. Please update your dependencies.
> node-sass@4.5.0 install E:\Workspace_WebStorm\angular2\node_modules\angular-cli\node_modules\node-sass
> node scripts/install.js
ESOCKETTIMEDOUT
Hint: If github is not accessible in your location
try setting a proxy via HTTP_PROXY, e.g.
or configure npm proxy via
> node-sass@4.5.0 postinstall E:\Workspace_WebStorm\angular2\node_modules\angular-cli\node_modules\node-sass
> node scripts/build.js
Binary found at E:\Workspace_WebStorm\angular2\node_modules\angular-cli\node_modules\node-sass\vendor\de
Testing binary
Binary has a problem: Error: %1 is not a valid Win32 application.
\\?\E:\Workspace_WebStorm\angular2\node_modules\angular-cli\node_modules\node-sass\vendor\de
at Object.Module._de (module.js:598:18)
at Module.load (module.js:488:32)
at tryModuleLoad (module.js:447:12)
at Function.Module._load (module.js:439:3)
quire (module.js:498:17)
at require (internal/module.js:20:19)
ports (E:\Workspace_WebStorm\angular2\node_modules\angular-cli\node_modules\node-sass\lib\binding.js:19:10)
at Object.<anonymous> (E:\Workspace_WebStorm\angular2\node_modules\angular-cli\node_modules\node-sass\lib\index.js:14:35)
at Module._compile (module.js:571:32)
at Object.Module._extensions..js (module.js:580:10)
Building the binary locally
Building: E:\ E:\Workspace_WebStorm\angular2\node_modules\node-gyp\bin\node-gyp.js rebuild --verbose --libsass_ext= --libsass_cflags= --libsass_ldflags= --libsass_library=
gyp info it worked if it ends with ok
gyp verb cli [ 'E:\\node\\',
gyp verb cli 'E:\\Workspace_WebStorm\\angular2\\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.5.0
gyp info using node@7.5.0 | 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 (E:\Workspace_WebStorm\angular2\node_modules\which\which.js:13:12)
gyp verb `which` failed at F (E:\Workspace_WebStorm\angular2\node_modules\which\which.js:68:19)
gyp verb `which` failed at E (E:\Workspace_WebStorm\angular2\node_modules\which\which.js:80:29)
gyp verb `which` failed at E:\Workspace_WebStorm\angular2\node_modules\which\which.js:89:16
gyp verb `which` failed at E:\Workspace_WebStorm\angular2\node_modules\isexe\index.js:44:5
gyp verb `which` failed at E:\Workspace_WebStorm\angular2\node_modules\isexe\windows.js:29:5
gyp verb `which` failed plete (fs.js:112:15)
gyp verb `which` failed python2 { Error: not found: python2
gyp verb `which` failed at getNotFoundError (E:\Workspace_WebStorm\angular2\node_modules\which\which.js:13:12)
gyp verb `which` failed at F (E:\Workspace_WebStorm\angular2\node_modules\which\which.js:68:19)
gyp verb `which` failed at E (E:\Workspace_WebStorm\angular2\node_modules\which\which.js:80:29)
gyp verb `which` failed at E:\Workspace_WebStorm\angular2\node_modules\which\which.js:89:16
gyp verb `which` failed at E:\Workspace_WebStorm\angular2\node_modules\isexe\index.js:44:5
gyp verb `which` failed at E:\Workspace_WebStorm\angular2\node_modules\isexe\windows.js:29:5
gyp verb `which` failed plete (fs.js:112:15) code: 'ENOENT' }
gyp verb check python checking for Python executable "python" in the PATH
gyp verb `which` succeeded python C:\Python27\python.EXE
gyp verb check python version `C:\Python27\python.EXE -c "import platform; print(platform.python_version());"` returned: "2.7.13\r\n"
gyp verb get node dir no --target version specified, falling back to host node version: 7.5.0
gyp verb command install [ '7.5.0' ]
gyp verb install input version string "7.5.0"
gyp verb install installing version: 7.5.0
gyp verb install --ensure was passed, so won't reinstall if already installed
gyp verb install version is already installed, need to check "installVersion"
gyp verb got "installVersion" 9
gyp verb needs "installVersion" 9
gyp verb install version is good
gyp verb get node dir target node version installed: 7.5.0
gyp verb build dir attempting to create "build" dir: E:\Workspace_WebStorm\angular2\node_modules\angular-cli\node_modules\node-sass\build
gyp verb build dir "build" dir needed to be created? E:\Workspace_WebStorm\angular2\node_modules\angular-cli\node_modules\node-sass\build
gyp verb pi creating config file
gyp verb pi writing out config file: E:\Workspace_WebStorm\angular2\node_modules\angular-cli\node_modules\node-sass\pi
gyp pi checking for gypi file: E:\Workspace_WebStorm\angular2\node_modules\angular-cli\node_modules\pi
gyp pi checking for gypi file: E:\Workspace_WebStorm\angular2\node_modules\angular-cli\node_modules\pi
gyp verb gyp gyp format was not specified; forcing "msvs"
gyp info spawn C:\Python27\python.EXE
gyp info spawn args [ 'E:\\Workspace_WebStorm\\angular2\\node_modules\\node-gyp\\gyp\\gyp_main.py',
gyp info spawn args 'p',
gyp info spawn args '-f',
gyp info spawn args 'msvs',
gyp info spawn args '-G',
gyp info spawn args 'msvs_version=auto',
gyp info spawn args '-I',
gyp info spawn args 'E:\\Workspace_WebStorm\\angular2\\node_modules\\angular-cli\\node_modules\\node-sass\\build\\pi',
gyp info spawn args '-I',
gyp info spawn args 'E:\\Workspace_WebStorm\\angular2\\node_modules\\node-gyp\\pi',
gyp info spawn args '-I',
gyp info spawn args 'C:\\Users\\lyx\\.node-gyp\\7.5.0\\include\\node\\pi',
gyp info spawn args '-Dlibrary=shared_library',
gyp info spawn args '-Dvisibility=default',
gyp info spawn args '-Dnode_root_dir=C:\\Users\\lyx\\.node-gyp\\7.5.0',
gyp info spawn args '-Dnode_gyp_dir=E:\\Workspace_WebStorm\\angular2\\node_modules\\node-gyp',
gyp info spawn args '-Dnode_lib_file=node.lib',
gyp info spawn args '-Dmodule_root_dir=E:\\Workspace_WebStorm\\angular2\\node_modules\\angular-cli\\node_modules\\node-sass',
gyp info spawn args '--depth=.',
gyp info spawn args '--no-parallel',
gyp info spawn args '--generator-output',
gyp info spawn args 'E:\\Workspace_WebStorm\\angular2\\node_modules\\angular-cli\\node_modules\\node-sass\\build',
gyp info spawn args '-Goutput_dir=.' ]
gyp verb command build []
gyp verb build type Release
gyp verb architecture x64
gyp verb node dev dir C:\Users\lyx\.node-gyp\7.5.0
gyp verb found first Solution file build/binding.sln
gyp verb could not find "" in PATH - finding location in registry
gyp verb "Release" dir needed to be created? null
gyp verb copying "node.lib" for x64 C:\Users\lyx\.node-gyp\7.5.0\Release\node.lib
gyp info spawn C:\Windows\Microsoft.NET\Framework\v4.0.
gyp info spawn args [ 'build/binding.sln',
gyp info spawn args '/nologo',
gyp info spawn args '/p:Configuration=Release;Platform=x64' ]
在此解决⽅案中⼀次⽣成⼀个项⽬。若要启⽤并⾏⽣成,请添加“/m”开关。
⽣成启动时间为 2017/2/26 16:01:32。
节点 1 上的项⽬“E:\Workspace_WebStorm\angular2\node_modules\angular-cli\node_modules\node-sass\build\binding.sln”(默认⽬标)。ValidateSolutionConfiguration:
正在⽣成解决⽅案配置“Release|x64”。
MSBUILD : error MSB3428: 未能加载 Visual C++ 组件“”。要解决此问题,1) 安装 .NET Framework 2.0 SDK;2) 安装 Microsoft Visual Stu
dio 2005;或 3) 如果将该组件安装到了其他位置,请将其位置添加到系统路径中。 [E:\Workspace_WebStorm\angular2\node_modules\angular-cli\node_modules\node-
sass\build\binding.sln]
已完成⽣成项⽬“E:\Workspace_WebStorm\angular2\node_modules\angular-cli\node_modules\node-sass\build\binding.sln”(默认⽬标)的操作 - 失败
⽣成失败。
“E:\Workspace_WebStorm\angular2\node_modules\angular-cli\node_modules\node-sass\build\binding.sln”(默认⽬标) (1) ->
(_src_\libsass ⽬标) ->
MSBUILD : error MSB3428: 未能加载 Visual C++ 组件“”。要解决此问题,1) 安装 .NET Framework 2.0 SDK;2) 安装 Microsoft Visual S
tudio 2005;或 3) 如果将该组件安装到了其他位置,请将其位置添加到系统路径中。 [E:\Workspace_WebStorm\angular2\node_modules\angular-cli\node_modules\nod
e-sass\build\binding.sln]
0 个警告
1 个错误
已⽤时间 00:00:00.57
gyp ERR! build error
gyp ERR! stack Error: `C:\Windows\Microsoft.NET\Framework\v4.0.` failed with exit code: 1
gyp ERR! stack Exit (E:\Workspace_WebStorm\angular2\node_modules\node-gyp\lib\build.js:276:23)
gyp ERR! stack at emitTwo (events.js:106:13)
gyp ERR! stack it (events.js:192:7)
gyp ERR! stack at Process.ChildProcess._it (internal/child_process.js:215:12)
gyp ERR! System Windows_NT 10.0.14393
gyp ERR! command "E:\\node\\" "E:\\Workspace_WebStorm\\angular2\\node_modules\\nod
e-gyp\\bin\\node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--
libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
gyp ERR! cwd E:\Workspace_WebStorm\angular2\node_modules\angular-cli\node_modules\node-sass
gyp ERR! node -v v7.5.0
gyp ERR! node-gyp -v v3.5.0
gyp ERR! not ok
Build failed with error code: 1
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.0.0 (node_modules\chokidar\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.1.1: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"}) npm WARN
enoent ENOENT: no such file or directory, open 'E:\Workspace_WebStorm\angular2\node_modules\node-sass\package.json'
npm WARN sass-loader@4.1.1 requires a peer of node-sass@^3.4.2 || ^4.0.0 but none was installed.
npm ERR! Windows_NT 10.0.14393
npm ERR! argv "E:\\node\\" "E:\\node\\node_modules\\npm\\bin\\npm-cli.js" "install"
npm ERR! node v7.5.0
npm ERR! npm v4.1.2
npm ERR! code ELIFECYCLE
npm ERR! node-sass@4.5.0 postinstall: `node scripts/build.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the node-sass@4.5.0 postinstall script 'node scripts/build.js'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, 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/build.js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs node-sass
npm ERR! Or if that isn't available, 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! E:\Workspace_WebStorm\angular2\npm-debug.log
------------------------------------------------------------------------
⽣成启动时间为 2016/6/27 星期⼀ 11:39:46。
节点 1 上的项⽬“C:\Users\世民\node_modules\node-sass\build\binding.sln”(默认⽬标)。
ValidateSolutionConfiguration:
正在⽣成解决⽅案配置“Release|x64”。
MSBUILD : error MSB3428: 未能加载 Visual C++ 组件“”。要解决此问题,1) 安装 .NET Framework 2.0 SDK;2) 安装 Microsoft Visual Studio 2005;或 3) 如果将该组件安装到了其他位置,请将其位置添加到系统路径中。 [C:\Users\世民\node_modules\node-sass\build\bindi
ng.sln]
已完成⽣成项⽬“C:\Users\世民\node_modules\node-sass\build\binding.sln”(默认⽬标)的操作 - 失败。
⽣成失败。
“C:\Users\世民\node_modules\node-sass\build\binding.sln”(默认⽬标) (1) ->
(_src_\libsass ⽬标) ->
MSBUILD : error MSB3428: 未能加载 Visual C++ 组件“”。要解决此问题,1) 安装 .NET Framework 2.0 SDK;2) 安装 Microsoft Visual Studio 2005;或 3) 如果将该组件安装到了其他位置,请将其位置添加到系统路径中。 [C:\Users\世民\node_modules\node-sass\build\bin
ding.sln]
0 个警告
1 个错误
然后呢,就⼀头赛到vc++组件⾥去,安装各种⽆⽤的东西,尝试过各种解决⽅案,最后实在是没有办法了,就仔细的从头到尾的看错误信息,然后在 node scripts/install.js 之后
发现这么⼀句话
Cannot download "github/sass/node-sass/releases/download/v3.8.0/de":
这句话⼤家都懂的哈,我就不说了,这⾥我也不知道为什么会下载失败,因为我的电脑全局代理的,正常的访问任何⽹站都是⽆阻碍的,百思不得解,
好吧那我就⾃⼰下载吧(为什么⾃⼰下载?因为我在google的时候也是发现了写有⽤的东西,虽然没那么直观哈,但是也给了我很多帮助)
下载完了之后把它注册成全局环境变量,两种⽅式:
第⼀种:直接右键我的电脑--》属性--》⾼级系统设置--》环境变量--》添加
第⼆种:set XXX=⽂件路经--》set SASS_BINARY_PATH=F:\lishiming\tools\node-sass\de
查看环境是否合适:echo %SASS_BINARY_PATH%
如果打印出来您配置好的⽂件地址那就ok了,
最后再来试试安装:npm i -g node-sass
参照上⾯的答案完美解决

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。