An error occurred while running npm install


#1

Hi i try to create my first app in ionic and i get this error :

f:\>ionic start bletry3
? What starter would you like to use: blank
✔ Creating directory .\bletry3 - done!
[INFO] Fetching app base (https://github.com/ionic-team/ionic2-app-base/archive/master.tar.gz)
✔ Downloading - done!
[INFO] Fetching starter template blank (https://github.com/ionic-team/ionic2-starter-blank/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 f:\bletry3\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 f:\bletry3\node_modules\fsevents
        > node install
        
        
        > node-sass@4.5.0 postinstall f:\bletry3\node_modules\node-sass
        > node scripts/build.js
        
        Building: D:\Program Files\nodejs\node.exe f:\bletry3\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 [ 'D:\\Program Files\\nodejs\\node.exe',
        gyp verb cli   'f:\\bletry3\\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.0.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 (f:\bletry3\node_modules\which\which.js:13:12)
        gyp verb `which` failed     at F (f:\bletry3\node_modules\which\which.js:68:19)
        gyp verb `which` failed     at E (f:\bletry3\node_modules\which\which.js:80:29)
        gyp verb `which` failed     at f:\bletry3\node_modules\which\which.js:89:16
        gyp verb `which` failed     at f:\bletry3\node_modules\isexe\index.js:42:5
        gyp verb `which` failed     at f:\bletry3\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 (f:\bletry3\node_modules\which\which.js:13:12)
        gyp verb `which` failed     at F (f:\bletry3\node_modules\which\which.js:68:19)
        gyp verb `which` failed     at E (f:\bletry3\node_modules\which\which.js:80:29)
        gyp verb `which` failed     at f:\bletry3\node_modules\which\which.js:89:16
        gyp verb `which` failed     at f:\bletry3\node_modules\isexe\index.js:42:5
        gyp verb `which` failed     at f:\bletry3\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:\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.0.0
        gyp verb command install [ '8.0.0' ]
        gyp verb install input version string "8.0.0"
        gyp verb install installing version: 8.0.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: 8.0.0
        gyp verb build dir attempting to create "build" dir: f:\bletry3\node_modules\node-sass\build
        gyp verb build dir "build" dir needed to be created? f:\bletry3\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: f:\bletry3\node_modules\node-sass\build\config.gypi
        gyp verb config.gypi checking for gypi file: f:\bletry3\node_modules\node-sass\config.gypi
        gyp verb common.gypi checking for gypi file: f:\bletry3\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 [ 'f:\\bletry3\\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   'f:\\bletry3\\node_modules\\node-sass\\build\\config.gypi',
        gyp info spawn args   '-I',
        gyp info spawn args   'f:\\bletry3\\node_modules\\node-gyp\\addon.gypi',
        gyp info spawn args   '-I',
        gyp info spawn args   'C:\\Users\\MBehtemam\\.node-gyp\\8.0.0\\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\\MBehtemam\\.node-gyp\\8.0.0',
        gyp info spawn args   '-Dnode_gyp_dir=f:\\bletry3\\node_modules\\node-gyp',
        gyp info spawn args   '-Dnode_lib_file=C:\\Users\\MBehtemam\\.node-gyp\\8.0.0\\<(target_arch)\\node.lib',
        gyp info spawn args   '-Dmodule_root_dir=f:\\bletry3\\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   'f:\\bletry3\\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\MBehtemam\.node-gyp\8.0.0
        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/16/2017 2:02:34 PM.
        Project "f:\bletry3\node_modules\node-sass\build\binding.sln" on node 1 (default targets).
        ValidateSolutionConfiguration:
        Building solution configuration "Release|x64".
        MSBUILD : error MSB3428: Could not load the Visual C++ component "VCBuild.exe". To fix this, 1) install the
        .NET Framework 2.0 SDK, 2) install Microsoft Visual Studio 2005 or 3) add the location of the component to
        the system path if it is installed elsewhere.  [f:\bletry3\node_modules\node-sass\build\binding.sln]
        Done Building Project "f:\bletry3\node_modules\node-sass\build\binding.sln" (default targets) -- FAILED.
        
        Build FAILED.
        
        "f:\bletry3\node_modules\node-sass\build\binding.sln" (default target) (1) ->
        (_src_\libsass target) ->
        MSBUILD : error MSB3428: Could not load the Visual C++ component "VCBuild.exe". To fix this, 1) install the
        .NET Framework 2.0 SDK, 2) install Microsoft Visual Studio 2005 or 3) add the location of the component to
        the system path if it is installed elsewhere.  [f:\bletry3\node_modules\node-sass\build\binding.sln]
        
        0 Warning(s)
        1 Error(s)
        
        Time Elapsed 00:00:01.20
        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 (f:\bletry3\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.15063
        gyp ERR! command "D:\\Program Files\\nodejs\\node.exe"
        "f:\\bletry3\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild" "--verbose" "--libsass_ext="
        "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
        gyp ERR! cwd f:\bletry3\node_modules\node-sass
        gyp ERR! node -v v8.0.0
        gyp ERR! node-gyp -v v3.6.2
        gyp ERR! not ok
        Build failed with error code: 1
        npm WARN Error: EPERM: operation not permitted, scandir
        'f:\bletry3\node_modules\are-we-there-yet\node_modules'
        npm WARN  { Error: EPERM: operation not permitted, scandir
        'f:\bletry3\node_modules\are-we-there-yet\node_modules'
        npm WARN   errno: -4048,
        npm WARN   code: 'EPERM',
        npm WARN   syscall: 'scandir',
        npm WARN   path: 'f:\\bletry3\\node_modules\\are-we-there-yet\\node_modules' }
        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\MBehtemam\AppData\Roaming\npm-cache\_logs\2017-06-16T09_32_39_772Z-debug.log
        

and my ionic info is :

f:\try>ionic info
[WARN] You are not in an Ionic project directory. Project context may be missing.

global packages:

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

System:

    Node       : v8.0.0
    OS         : Windows 10
    Xcode      : not installed
    ios-deploy : not installed
    ios-sim    : not installed
    npm        : 5.0.0```

#2

Ionic is not ready for npm5 on windows. Install an older npm and this will work.


#3

thanks for your replay , how to i do it


#4

Best uninstall node and install e.g. node 6.x: https://nodejs.org/en/ This will bring an older (but stable) npm as well.


#5

I fixed this by downgrading npm to version 4.6.1.


#6

I don’t think this is an issue anymore with the new npm, just FYI. You might want to install the latest npm and confirm. The problem existed for npm 5.0.x, and they’ve moved beyond that.


#7

how did you install the lower version of npm?


#8

npm install -g npm@version

for ex. If I want to downgrade from npm 5.4.2 to 4.6.1
then,
npm install -g npm@4.6.1