尝试使用npm安装laravel-elixir时如何解决以下错误

时间:2019-04-11 08:32:40

标签: php laravel npm gulp laravel-elixir

我正在使用laravel框架构建Web应用程序。在那我需要安装gulp。我使用npm安装了gulp,并在输入命令gulp时提示我安装laravel-elixir。我尝试使用npm install laravel-elixir进行安装,但是它会引发许多错误。

我使用的是laravel版本5.2,节点版本10.15.3,python 2.7。我在某些地方安装了可视化的c ++构建工具,但没有任何效果。以下是我遇到的错误。

C:\xampp\htdocs\udemy>npm install laravel-elixir
npm WARN deprecated babel-preset-es2015@6.24.1: ?  Thanks for using Babel: we recommend using babel-preset-env now: please read babeljs.io/e
nv to update!
npm WARN deprecated minimatch@2.0.10: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated browserslist@0.4.0: Browserslist 2 could fail on reading Browserslist >3.0 config used in other tools.
npm WARN deprecated browserslist@1.7.7: Browserslist 2 could fail on reading Browserslist >3.0 config used in other tools.
npm WARN deprecated minimatch@1.0.0: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue

> node-sass@3.13.1 install C:\xampp\htdocs\udemy\node_modules\laravel-elixir\node_modules\node-sass
> node scripts/install.js

Downloading binary from https://github.com/sass/node-sass/releases/download/v3.13.1/win32-x64-64_binding.node
Cannot download "https://github.com/sass/node-sass/releases/download/v3.13.1/win32-x64-64_binding.node":

HTTP error 404 Not Found

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@3.13.1 postinstall C:\xampp\htdocs\udemy\node_modules\laravel-elixir\node_modules\node-sass
> node scripts/build.js

Building: C:\Program Files\nodejs\node.exe C:\xampp\htdocs\udemy\node_modules\node-gyp\bin\node-gyp.js rebuild --verbose --libsass_ext= --li
bsass_cflags= --libsass_ldflags= --libsass_library=
gyp info it worked if it ends with ok
gyp verb cli [ 'C:\\Program Files\\nodejs\\node.exe',
gyp verb cli   'C:\\xampp\\htdocs\\udemy\\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.8.0
gyp info using node@10.15.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.7" in the PATH
gyp verb `which` failed Error: not found: python2.7
gyp verb `which` failed     at getNotFoundError (C:\xampp\htdocs\udemy\node_modules\which\which.js:13:12)
gyp verb `which` failed     at F (C:\xampp\htdocs\udemy\node_modules\which\which.js:68:19)
gyp verb `which` failed     at E (C:\xampp\htdocs\udemy\node_modules\which\which.js:80:29)
gyp verb `which` failed     at C:\xampp\htdocs\udemy\node_modules\which\which.js:89:16
gyp verb `which` failed     at C:\xampp\htdocs\udemy\node_modules\isexe\index.js:42:5
gyp verb `which` failed     at C:\xampp\htdocs\udemy\node_modules\isexe\windows.js:36:5
gyp verb `which` failed     at FSReqWrap.oncomplete (fs.js:153:21)
gyp verb `which` failed  python2.7 { Error: not found: python2.7
gyp verb `which` failed     at getNotFoundError (C:\xampp\htdocs\udemy\node_modules\which\which.js:13:12)
gyp verb `which` failed     at F (C:\xampp\htdocs\udemy\node_modules\which\which.js:68:19)
gyp verb `which` failed     at E (C:\xampp\htdocs\udemy\node_modules\which\which.js:80:29)
gyp verb `which` failed     at C:\xampp\htdocs\udemy\node_modules\which\which.js:89:16
gyp verb `which` failed     at C:\xampp\htdocs\udemy\node_modules\isexe\index.js:42:5
gyp verb `which` failed     at C:\xampp\htdocs\udemy\node_modules\isexe\windows.js:36:5
gyp verb `which` failed     at FSReqWrap.oncomplete (fs.js:153:21)
gyp verb `which` failed   stack:
gyp verb `which` failed    'Error: not found: python2.7\n    at getNotFoundError (C:\\xampp\\htdocs\\udemy\\node_modules\\which\\which.js:13
:12)\n    at F (C:\\xampp\\htdocs\\udemy\\node_modules\\which\\which.js:68:19)\n    at E (C:\\xampp\\htdocs\\udemy\\node_modules\\which\\whi
ch.js:80:29)\n    at C:\\xampp\\htdocs\\udemy\\node_modules\\which\\which.js:89:16\n    at C:\\xampp\\htdocs\\udemy\\node_modules\\isexe\\in
dex.js:42:5\n    at C:\\xampp\\htdocs\\udemy\\node_modules\\isexe\\windows.js:36:5\n    at FSReqWrap.oncomplete (fs.js:153:21)',
gyp verb `which` failed   code: 'ENOENT' }
gyp verb could not find "python2.7". checking python launcher
gyp verb could not find "python2.7". guessing location
gyp verb ensuring that file exists: C:\Python27\python.exe
gyp verb check python version `C:\Python27\python.exe -c "import sys; print "2.7.14
gyp verb check python version .%s.%s" % sys.version_info[:3];"` returned: %j
gyp verb get node dir no --target version specified, falling back to host node version: 10.15.3
gyp verb command install [ '10.15.3' ]
gyp verb install input version string "10.15.3"
gyp verb install installing version: 10.15.3
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: 10.15.3
gyp verb build dir attempting to create "build" dir: C:\xampp\htdocs\udemy\node_modules\laravel-elixir\node_modules\node-sass\build
gyp verb build dir "build" dir needed to be created? C:\xampp\htdocs\udemy\node_modules\laravel-elixir\node_modules\node-sass\build
gyp verb find vs2017 Found installation at: C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools
gyp verb find vs2017   - Found Microsoft.VisualStudio.Component.VC.Tools.x86.x64
gyp verb find vs2017   - Found Microsoft.VisualStudio.VC.MSBuild.Base
gyp verb find vs2017   - Missing a Windows SDK (Microsoft.VisualStudio.Component.Windows10SDK.* or Microsoft.VisualStudio.Component.Windows8
1SDK)
gyp verb find vs2017   - Some required components are missing, not using this installation
gyp verb Not using VS2017: No usable installation of VS2017 found
gyp verb build/config.gypi creating config file
gyp verb build/config.gypi writing out config file: C:\xampp\htdocs\udemy\node_modules\laravel-elixir\node_modules\node-sass\build\config.gy
pi
gyp verb config.gypi checking for gypi file: C:\xampp\htdocs\udemy\node_modules\laravel-elixir\node_modules\node-sass\config.gypi
gyp verb common.gypi checking for gypi file: C:\xampp\htdocs\udemy\node_modules\laravel-elixir\node_modules\node-sass\common.gypi
gyp verb gyp gyp format was not specified; forcing "msvs"
gyp info spawn C:\Python27\python.exe
gyp info spawn args [ 'C:\\xampp\\htdocs\\udemy\\node_modules\\node-gyp\\gyp\\gyp_main.py',
gyp info spawn args   'binding.gyp',
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   'C:\\xampp\\htdocs\\udemy\\node_modules\\laravel-elixir\\node_modules\\node-sass\\build\\config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   'C:\\xampp\\htdocs\\udemy\\node_modules\\node-gyp\\addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   'C:\\Users\\Dell\\.node-gyp\\10.15.3\\include\\node\\common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_root_dir=C:\\Users\\Dell\\.node-gyp\\10.15.3',
gyp info spawn args   '-Dnode_gyp_dir=C:\\xampp\\htdocs\\udemy\\node_modules\\node-gyp',
gyp info spawn args   '-Dnode_lib_file=C:\\Users\\Dell\\.node-gyp\\10.15.3\\<(target_arch)\\node.lib',
gyp info spawn args   '-Dmodule_root_dir=C:\\xampp\\htdocs\\udemy\\node_modules\\laravel-elixir\\node_modules\\node-sass',
gyp info spawn args   '-Dnode_engine=v8',
gyp info spawn args   '--depth=.',
gyp info spawn args   '--no-parallel',
gyp info spawn args   '--generator-output',
gyp info spawn args   'C:\\xampp\\htdocs\\udemy\\node_modules\\laravel-elixir\\node_modules\\node-sass\\build',
gyp info spawn args   '-Goutput_dir=.' ]
Warning: unrecognized setting VCCLCompilerTool/MultiProcessorCompilation
Warning: unrecognized setting VCCLCompilerTool/MultiProcessorCompilation
Warning: unrecognized setting VCCLCompilerTool/MultiProcessorCompilation
Warning: unrecognized setting VCCLCompilerTool/MultiProcessorCompilation
gyp verb command build []
gyp verb build type Release
gyp verb architecture x64
gyp verb node dev dir C:\Users\Dell\.node-gyp\10.15.3
gyp verb found first Solution file build/binding.sln
gyp verb could not find "msbuild.exe" in PATH - finding location in registry
gyp ERR! build error
gyp ERR! stack Error: Command failed: reg query "HKLM\Software\Microsoft\MSBuild\ToolsVersions" /s /reg:32
gyp ERR! stack 'reg' is not recognized as an internal or external command,
gyp ERR! stack operable program or batch file.
gyp ERR! stack
gyp ERR! stack Can't find "msbuild.exe". Do you have Microsoft Visual Studio C++ 2008+ installed?
gyp ERR! stack     at C:\xampp\htdocs\udemy\node_modules\node-gyp\lib\build.js:142:25
gyp ERR! stack     at ChildProcess.exithandler (child_process.js:301:5)
gyp ERR! stack     at ChildProcess.emit (events.js:189:13)
gyp ERR! stack     at maybeClose (internal/child_process.js:970:16)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5)
gyp ERR! System Windows_NT 6.1.7601
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\xampp\\htdocs\\udemy\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild" "--ver
bose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
gyp ERR! cwd C:\xampp\htdocs\udemy\node_modules\laravel-elixir\node_modules\node-sass
gyp ERR! node -v v10.15.3
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
Build failed with error code: 1
npm WARN rollback Rolling back node-pre-gyp@0.10.3 failed (this is probably harmless): EPERM: operation not permitted, lstat 'C:\xampp\htdoc
s\udemy\node_modules\fsevents\node_modules'
npm WARN rollback Rolling back node-sass@3.13.1 failed (this is probably harmless): EPERM: operation not permitted, rmdir 'C:\xampp\htdocs\u
demy\node_modules\laravel-elixir\node_modules'
npm WARN acorn-dynamic-import@4.0.0 requires a peer of acorn@^6.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.7 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.7: wanted {"os":"darwin","arch":"any"} (current: {"os":"
win32","arch":"x64"})

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! node-sass@3.13.1 postinstall: `node scripts/build.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the node-sass@3.13.1 postinstall 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\Dell\AppData\Roaming\npm-cache\_logs\2019-04-11T07_17_38_254Z-debug.log

有人可以建议我如何成功安装laravel-elixir来使gulp正常工作。 package.json file

2 个答案:

答案 0 :(得分:0)

您将收到“找不到HTTP错误404”,因为您正在尝试安装Github上不存在的node-sass(v3.13.1)版本。

尝试以下操作:

  1. 删除您的node_modules文件夹和package-lock.json文件
  2. 运行npm install node-sass --save-dev
  3. 运行npm install gulp-sass --save-dev
  4. 运行npm install

如果仍然无法正常运行,请尝试也更新laravel-elixir。
在package.json中对其进行编辑,或者从命令行进行更新。
当前最新版本是6.0.0-18,而您正在使用^ 5.0.0。

答案 1 :(得分:0)

您正尝试安装node-sass上不再可用的旧版本的Github

尝试打开package.json文件或package-lock.json文件,并将node-sass版本更新为^4.12.0