ionic-team / ionic-app-scripts

App Build Scripts for Ionic Projects
http://ionicframework.com/
MIT License
608 stars 304 forks source link

'ionic start' fails during npm install on node-sass@4.5.0 due to 404 on binary download #1047

Open mattezell opened 7 years ago

mattezell commented 7 years ago

Note: for support questions, please use one of these channels:

https://forum.ionicframework.com/ http://ionicworldwide.herokuapp.com/

Short description of the problem:

"ionic start myApp super" fails during npm install on node-sass@4.5.0 due to 404 on binary download.

What behavior are you expecting?

For "ionic start" to generate an application based on the 'super' template.

Steps to reproduce:

  1. Be on windows (?)
  2. Install latest NodeJS, Cordova, Ionic
  3. run "ionic start myApp super"
Microsoft Windows [Version 10.0.14393]
(c) 2016 Microsoft Corporation. All rights reserved.

C:\Users\matt>cd \w\

C:\w>ionic start super super
✔ Creating directory .\super - done!
[INFO] Fetching app base (https://github.com/ionic-team/ionic2-app-base/archive/master.tar.gz)
✔ Downloading - done!
[INFO] Fetching starter template super (https://github.com/ionic-team/ionic-starter-super/archive/master.tar.gz)
✔ Downloading - done!
✔ Updating package.json with app details - done!
✔ Creating configuration file ionic.config.json - done!
[INFO] Installing dependencies may take several minutes!
> npm install
✖ Running command - failed!
[ERROR] An error occurred while running npm install (exit code 1):

        npm WARN deprecated object-keys@0.2.0: Please update to the latest object-keys
        npm WARN prefer global node-gyp@3.6.2 should be installed with -g

        > node-sass@4.5.0 install C:\w\super\node_modules\node-sass
        > node scripts/install.js

        Downloading binary from https://github.com/sass/node-sass/releases/download/v4.5.0/win32-x64-57_binding.node
        Cannot download "https://github.com/sass/node-sass/releases/download/v4.5.0/win32-x64-57_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

        > fsevents@1.1.2 install C:\w\super\node_modules\fsevents
        > node install

        > node-sass@4.5.0 postinstall C:\w\super\node_modules\node-sass
        > node scripts/build.js

        Building: C:\Program Files\nodejs\node.exe C:\w\super\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 [ 'C:\\Program Files\\nodejs\\node.exe',
        gyp verb cli   'C:\\w\\super\\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@8.1.2 | 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:\w\super\node_modules\which\which.js:13:12)
        gyp verb `which` failed     at F (C:\w\super\node_modules\which\which.js:68:19)
        gyp verb `which` failed     at E (C:\w\super\node_modules\which\which.js:80:29)
        gyp verb `which` failed     at C:\w\super\node_modules\which\which.js:89:16
        gyp verb `which` failed     at C:\w\super\node_modules\isexe\index.js:42:5
        gyp verb `which` failed     at C:\w\super\node_modules\isexe\windows.js:36:5
        gyp verb `which` failed     at FSReqWrap.oncomplete (fs.js:152:21)
        gyp verb `which` failed  python2 { Error: not found: python2
        gyp verb `which` failed     at getNotFoundError (C:\w\super\node_modules\which\which.js:13:12)
        gyp verb `which` failed     at F (C:\w\super\node_modules\which\which.js:68:19)
        gyp verb `which` failed     at E (C:\w\super\node_modules\which\which.js:80:29)
        gyp verb `which` failed     at C:\w\super\node_modules\which\which.js:89:16
        gyp verb `which` failed     at C:\w\super\node_modules\isexe\index.js:42:5
        gyp verb `which` failed     at C:\w\super\node_modules\isexe\windows.js:36:5
        gyp verb `which` failed     at FSReqWrap.oncomplete (fs.js:152:21) code: 'ENOENT' }
        gyp verb check python checking for Python executable "python" in the PATH
        gyp verb `which` succeeded python C:\Users\matt\AppData\Local\Programs\Python\Python36\python.EXE
        gyp verb check python version `C:\Users\matt\AppData\Local\Programs\Python\Python36\python.EXE -c "import
        platform; print(platform.python_version());"` returned: "3.6.1\r\n"
        gyp verb could not find "C:\Users\matt\AppData\Local\Programs\Python\Python36\python.EXE". checking python
        launcher
        gyp verb check python launcher python executable found: "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: 8.1.2
        gyp verb command install [ '8.1.2' ]
        gyp verb install input version string "8.1.2"
        gyp verb install installing version: 8.1.2
        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: 8.1.2
        gyp verb build dir attempting to create "build" dir: C:\w\super\node_modules\node-sass\build
        gyp verb build dir "build" dir needed to be created? C:\w\super\node_modules\node-sass\build
        gyp verb Not using VS2017: Could not use PowerShell to find VS2017
        gyp verb build/config.gypi creating config file
        gyp verb build/config.gypi writing out config file: C:\w\super\node_modules\node-sass\build\config.gypi
        gyp verb config.gypi checking for gypi file: C:\w\super\node_modules\node-sass\config.gypi
        gyp verb common.gypi checking for gypi file: C:\w\super\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:\\w\\super\\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:\\w\\super\\node_modules\\node-sass\\build\\config.gypi',
        gyp info spawn args   '-I',
        gyp info spawn args   'C:\\w\\super\\node_modules\\node-gyp\\addon.gypi',
        gyp info spawn args   '-I',
        gyp info spawn args   'C:\\Users\\matt\\.node-gyp\\8.1.2\\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\\matt\\.node-gyp\\8.1.2',
        gyp info spawn args   '-Dnode_gyp_dir=C:\\w\\super\\node_modules\\node-gyp',
        gyp info spawn args   '-Dnode_lib_file=C:\\Users\\matt\\.node-gyp\\8.1.2\\<(target_arch)\\node.lib',
        gyp info spawn args   '-Dmodule_root_dir=C:\\w\\super\\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:\\w\\super\\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\matt\.node-gyp\8.1.2
        gyp verb found first Solution file build/binding.sln
        gyp verb could not find "msbuild.exe" in PATH - finding location in registry
        gyp info spawn C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe
        gyp info spawn args [ 'build/binding.sln',
        gyp info spawn args   '/nologo',
        gyp info spawn args   '/p:Configuration=Release;Platform=x64' ]
        Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
        Build started 6/19/2017 8:19:01 PM.
        MSBUILD : error MSB4132: The tools version "2.0" is unrecognized. Available tools versions are "4.0".

        Build FAILED.

        MSBUILD : error MSB4132: The tools version "2.0" is unrecognized. Available tools versions are "4.0".

        0 Warning(s)
        1 Error(s)

        Time Elapsed 00:00:00.03
        gyp ERR! build error
        gyp ERR! stack Error: `C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe` failed with exit code: 1
        gyp ERR! stack     at ChildProcess.onExit (C:\w\super\node_modules\node-gyp\lib\build.js:258:23)
        gyp ERR! stack     at emitTwo (events.js:125:13)
        gyp ERR! stack     at ChildProcess.emit (events.js:213:7)
        gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:197:12)
        gyp ERR! System Windows_NT 10.0.14393
        gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\w\\super\\node_modules\\node-gyp\\bin\\node-gyp.js"
        "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
        gyp ERR! cwd C:\w\super\node_modules\node-sass
        gyp ERR! node -v v8.1.2
        gyp ERR! node-gyp -v v3.6.2
        gyp ERR! not ok
        Build failed with error code: 1
        npm ERR! code ELIFECYCLE
        npm ERR! errno 1
        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.
        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\matt\AppData\Roaming\npm-cache\_logs\2017-06-20T01_19_04_643Z-debug.log

C:\w>cd super

C:\w\super>ionic info --verbose
[DEBUG] Loading global plugin @ionic/cli-plugin-proxy
[DEBUG] Throwing PLUGIN_NOT_INSTALLED for global @ionic/cli-plugin-proxy
[DEBUG] Loading local plugin @ionic/cli-plugin-ionic-angular
? Looks like this is an Ionic Angular project, would you like to install @ionic/cli-plugin-ionic-angular and continue? Yes
> npm install --save-dev --save-exact @ionic/cli-plugin-ionic-angular@latest
✔ Running command - done!
[DEBUG] Loading local plugin @ionic/cli-plugin-ionic-angular
[DEBUG] Throwing PLUGIN_NOT_INSTALLED for local @ionic/cli-plugin-ionic-angular
[WARN] You have no CLI project plugins installed. CLI functionality may be limited.

global packages:

    @ionic/cli-utils : 1.4.0
    Ionic CLI        : 3.4.0

System:

    Node       : v8.1.2
    OS         : Windows 10
    Xcode      : not installed
    ios-deploy : not installed
    ios-sim    : not installed
    npm        : 5.0.3

C:\w\super>
danielsogl commented 7 years ago

Downgrade npm/node to 6/7.

vkniazeu commented 7 years ago

@danielsogl, would you happen to know if there's an issue to track support being added for node 8/npm 5? I can't seem to find one. Thank you!

andrevcf commented 7 years ago

node 8 will be supported?

Lidu4git commented 7 years ago

i have the same problem how can i solve it am using window 10 Node.js 6.11.0 npm 3.

Lidu4git commented 7 years ago

C:\Windows\System32\myApp>npm install npm WARN invalid config proxy="$PROXY" npm WARN invalid config Must be a full url with 'http://' npm WARN invalid config proxy="$PROXY" npm WARN invalid config Must be a full url with 'http://' npm WARN prefer global node-gyp@3.6.2 should be installed with -g

node-sass@4.5.3 install C:\Windows\System32\myApp\node_modules\node-sass node scripts/install.js

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

ESOCKETTIMEDOUT

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.5.3 postinstall C:\Windows\System32\myApp\node_modules\node-sass node scripts/build.js

Binary found at C:\Windows\System32\myApp\node_modules\node-sass\vendor\win32-x64-48\binding.node Testing binary Binary has a problem: Error: %1 is not a valid Win32 application. \?\C:\Windows\System32\myApp\node_modules\node-sass\vendor\win32-x64-48\binding.node at Error (native) at Object.Module._extensions..node (module.js:597:18) at Module.load (module.js:487:32) at tryModuleLoad (module.js:446:12) at Function.Module._load (module.js:438:3) at Module.require (module.js:497:17) at require (internal/module.js:20:19) at module.exports (C:\Windows\System32\myApp\node_modules\node-sass\lib\binding.js:19:10) at Object. (C:\Windows\System32\myApp\node_modules\node-sass\lib\index.js:14:35) at Module._compile (module.js:570:32) Building the binary locally Building: C:\Program Files\nodejs\node.exe C:\Windows\System32\myApp\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 [ 'C:\Program Files\nodejs\node.exe', gyp verb cli 'C:\Windows\System32\myApp\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.11.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 (C:\Windows\System32\myApp\node_modules\which\which.js:13:12) gyp verb which failed at F (C:\Windows\System32\myApp\node_modules\which\which.js:68:19) gyp verb which failed at E (C:\Windows\System32\myApp\node_modules\which\which.js:80:29) gyp verb which failed at C:\Windows\System32\myApp\node_modules\which\which.js:89:16 gyp verb which failed at C:\Windows\System32\myApp\node_modules\isexe\index.js:42:5 gyp verb which failed at C:\Windows\System32\myApp\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 gyp verb which failed at getNotFoundError (C:\Windows\System32\myApp\node_modules\which\which.js:13:12) gyp verb which failed at F (C:\Windows\System32\myApp\node_modules\which\which.js:68:19) gyp verb which failed at E (C:\Windows\System32\myApp\node_modules\which\which.js:80:29) gyp verb which failed at C:\Windows\System32\myApp\node_modules\which\which.js:89:16 gyp verb which failed at C:\Windows\System32\myApp\node_modules\isexe\index.js:42:5 gyp verb which failed at C:\Windows\System32\myApp\node_modules\isexe\windows.js:36:5 gyp verb which failed at FSReqWrap.oncomplete (fs.js:123:15) gyp verb which failed stack: 'Error: not found: python2\n at getNotFoundError (C:\Windows\System32\myApp\node_modules\which\which.js:13:12)\n at F (C:\Windows\System32\myApp\node_modules\which\which.js:68:19)\n at E (C:\Windows\System32\myApp\node_modules\which\which.js:80:29)\n at C:\Windows\System32\myApp\node_modules\which\which.js:89:16\n at C:\Windows\System32\myApp\node_modules\isexe\index.js:42:5\n at C:\Windows\System32\myApp\node_modules\isexe\windows.js:36:5\n at FSReqWrap.oncomplete (fs.js:123:15)', gyp verb which failed code: 'ENOENT' } gyp verb check python checking for Python executable "python" in the PATH gyp verb which succeeded python C:\Users\DataMining\AppData\Local\Programs\Python\Python35\python.EXE gyp verb check python version C:\Users\DataMining\AppData\Local\Programs\Python\Python35\python.EXE -c "import platform; print(platform.python_version());" returned: "3.5.2\r\n" gyp verb could not find "C:\Users\DataMining\AppData\Local\Programs\Python\Python35\python.EXE". checking python launcher gyp verb could not find "C:\Users\DataMining\AppData\Local\Programs\Python\Python35\python.EXE". guessing location gyp verb ensuring that file exists: C:\Python27\python.exe gyp ERR! configure error gyp ERR! stack Error: Can't find Python executable "C:\Users\DataMining\AppData\Local\Programs\Python\Python35\python.EXE", you can set the PYTHON env variable. gyp ERR! stack at Object.failNoPython (C:\Windows\System32\myApp\node_modules\node-gyp\lib\configure.js:483:19) gyp ERR! stack at Object. (C:\Windows\System32\myApp\node_modules\node-gyp\lib\configure.js:508:16) gyp ERR! stack at C:\Windows\System32\myApp\node_modules\graceful-fs\polyfills.js:284:29 gyp ERR! stack at FSReqWrap.oncomplete (fs.js:123:15) gyp ERR! System Windows_NT 10.0.14393 gyp ERR! command "C:\Program Files\nodejs\node.exe" "C:\Windows\System32\myApp\node_modules\node-gyp\bin\node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library=" gyp ERR! cwd C:\Windows\System32\myApp\node_modules\node-sass gyp ERR! node -v v6.11.0 gyp ERR! node-gyp -v v3.6.2 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.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"}) npm ERR! Windows_NT 10.0.14393 npm ERR! argv "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" "install" npm ERR! node v6.11.0 npm ERR! npm v3.10.10 npm ERR! code ELIFECYCLE

npm ERR! node-sass@4.5.3 postinstall: node scripts/build.js npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the node-sass@4.5.3 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! C:\Windows\System32\myApp\npm-debug.log

blackslifer888 commented 7 years ago

hi downgrade the npm in mac

npm install -g npm@4.6.1

and downgrade node

brew uninstall node

After this you just have to install the version you want to. This can usually be done with brew, although the package/formulae versioning did change recently; something like:

brew install node@6

this might be optional

brew link --force node@6

and fix this bug. i work for me.

hamzahamidi commented 6 years ago

I solved this issue by updating ionic-cli & downgrading node & npm. Here is my config:

$ ionic info

cli packages: (/home/qdmb9595/.nvm/versions/node/v6.11.5/lib/node_modules)

    @ionic/cli-plugin-proxy : 1.5.6
    @ionic/cli-utils        : 1.19.0
    ionic (Ionic CLI)       : 3.19.0

global packages:

    cordova (Cordova CLI) : 7.1.0 

local packages:

    @ionic/app-scripts : 3.1.6
    Cordova Platforms  : none
    Ionic Framework    : ionic-angular 3.9.2

System:

    Node : v6.11.5
    npm  : 3.10.10 
    OS   : Linux 4.4

https://github.com/sass/libsass/issues/2470

tchoua08 commented 4 years ago

npm install @ionic/app-scripts@latest --save-dev work for me

ttoliveira commented 4 years ago

npm install @ionic/app-scripts@latest --save-dev work for me

Yehh!! work for me tanks