Search code examples
ionic-frameworkionic3sourceforge-appscript

I am getting error in running my Ionic Application


In my mac After I run command >sudo ionic serve I get -:

ionic-app-scripts serve --address 0.0.0.0 --port 8100 --livereload-port 35729 --dev-logger-port 53703 --nobrowser

[INFO] Looks like @ionic/app-scripts isn't installed in this project.

   This package is required for this command to work properly.

? Install @ionic/app-scripts? Yes

When I start installing it using cli command > npm i -D -E @ionic/app-scripts I get -:

npm WARN deprecated hoek@2.16.3: The major version is no longer supported. Please update to 4.x or newer

> node-sass@4.9.0 install /Users/user/Projects/MyIonicProject/node_modules/node-sass
> node scripts/install.js

Unable to save binary /Users/user/Projects/MyIonicProject/node_modules/node-sass/vendor/darwin-x64-64 : { Error: EACCES: permission denied, mkdir '/Users/user/Projects/MyIonicProject/node_modules/node-sass/vendor'
    at Object.fs.mkdirSync (fs.js:854:3)
    at sync (/Users/user/Projects/MyIonicProject/node_modules/mkdirp/index.js:71:13)
    at Function.sync (/Users/user/Projects/MyIonicProject/node_modules/mkdirp/index.js:77:24)
    at checkAndDownloadBinary (/Users/user/Projects/MyIonicProject/node_modules/node-sass/scripts/install.js:114:11)
    at Object.<anonymous> (/Users/user/Projects/MyIonicProject/node_modules/node-sass/scripts/install.js:157:1)
    at Module._compile (internal/modules/cjs/loader.js:678:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:689:10)
    at Module.load (internal/modules/cjs/loader.js:589:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:528:12)
    at Function.Module._load (internal/modules/cjs/loader.js:520:3)
  errno: -13,
  syscall: 'mkdir',
  code: 'EACCES',
  path: '/Users/user/Projects/MyIonicProject/node_modules/node-sass/vendor' }

> node-sass@4.9.0 postinstall /Users/user/Projects/MyIonicProject/node_modules/node-sass
> node scripts/build.js

Building: /usr/local/bin/node /Users/user/Projects/MyIonicProject/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 [ '/usr/local/bin/node',
gyp verb cli   '/Users/user/Projects/MyIonicProject/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.1.0 | darwin | 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 (/Users/user/Projects/MyIonicProject/node_modules/which/which.js:13:12)
gyp verb `which` failed     at F (/Users/user/Projects/MyIonicProject/node_modules/which/which.js:68:19)
gyp verb `which` failed     at E (/Users/user/Projects/MyIonicProject/node_modules/which/which.js:80:29)
gyp verb `which` failed     at /Users/user/Projects/MyIonicProject/node_modules/which/which.js:89:16
gyp verb `which` failed     at /Users/user/Projects/MyIonicProject/node_modules/isexe/index.js:42:5
gyp verb `which` failed     at /Users/user/Projects/MyIonicProject/node_modules/isexe/mode.js:8:5
gyp verb `which` failed     at FSReqWrap.oncomplete (fs.js:165:21)
gyp verb `which` failed  python2 { Error: not found: python2
gyp verb `which` failed     at getNotFoundError (/Users/user/Projects/MyIonicProject/node_modules/which/which.js:13:12)
gyp verb `which` failed     at F (/Users/user/Projects/MyIonicProject/node_modules/which/which.js:68:19)
gyp verb `which` failed     at E (/Users/user/Projects/MyIonicProject/node_modules/which/which.js:80:29)
gyp verb `which` failed     at /Users/user/Projects/MyIonicProject/node_modules/which/which.js:89:16
gyp verb `which` failed     at /Users/user/Projects/MyIonicProject/node_modules/isexe/index.js:42:5
gyp verb `which` failed     at /Users/user/Projects/MyIonicProject/node_modules/isexe/mode.js:8:5
gyp verb `which` failed     at FSReqWrap.oncomplete (fs.js:165:21)
gyp verb `which` failed   stack: 'Error: not found: python2\n    at getNotFoundError (/Users/user/Projects/MyIonicProject/node_modules/which/which.js:13:12)\n    at F (/Users/user/Projects/MyIonicProject/node_modules/which/which.js:68:19)\n    at E (/Users/user/Projects/MyIonicProject/node_modules/which/which.js:80:29)\n    at /Users/user/Projects/MyIonicProject/node_modules/which/which.js:89:16\n    at /Users/user/Projects/MyIonicProject/node_modules/isexe/index.js:42:5\n    at /Users/user/Projects/MyIonicProject/node_modules/isexe/mode.js:8:5\n    at FSReqWrap.oncomplete (fs.js:165:21)',
gyp verb `which` failed   code: 'ENOENT' }
gyp verb check python checking for Python executable "python" in the PATH
gyp verb `which` succeeded python /usr/bin/python
gyp verb check python version `/usr/bin/python -c "import sys; print "2.7.10
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.1.0
gyp verb command install [ '10.1.0' ]
gyp verb install input version string "10.1.0"
gyp verb install installing version: 10.1.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: 10.1.0
gyp verb build dir attempting to create "build" dir: /Users/user/Projects/MyIonicProject/node_modules/node-sass/build
gyp ERR! configure error 
gyp ERR! stack Error: EACCES: permission denied, mkdir '/Users/user/Projects/MyIonicProject/node_modules/node-sass/build'
gyp ERR! System Darwin 15.4.0
gyp ERR! command "/usr/local/bin/node" "/Users/user/Projects/MyIonicProject/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
gyp ERR! cwd /Users/user/Projects/MyIonicProject/node_modules/node-sass
gyp ERR! node -v v10.1.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok 
Build failed with error code: 1
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! node-sass@4.9.0 postinstall: `node scripts/build.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the node-sass@4.9.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!     /Users/user/.npm/_logs/2018-09-21T07_51_45_171Z-debug.log
[ERROR] An error occurred while running subprocess npm.

        npm i -D -E @ionic/app-scripts exited with exit code 1.

        Re-running this command with the --verbose flag may provide more 
        information.
users-MacBook-Pro-3:MyIonicProject user$ 

As you can see Above I am getting Error I am putting some error part of above code below kindly look into it :

gyp ERR! cwd /Users/user/Projects/MyIonicProject/node_modules/node-sass gyp ERR! node -v v10.1.0 gyp ERR! node-gyp -v v3.8.0 gyp ERR! not ok Build failed with error code: 1 npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! node-sass@4.9.0 postinstall: node scripts/build.js npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the node-sass@4.9.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!
/Users/user/.npm/_logs/2018-09-21T07_51_45_171Z-debug.log [ERROR] An error occurred while running subprocess npm.

    npm i -D -E @ionic/app-scripts exited with exit code 1.

    Re-running this command with the --verbose flag may provide more 
    information.

I am getting error here ... and not able to run my ionic app , I have also deleted and reinstall npm but it dosen't worked for me kindly help me


Solution

  • You are getting an 'EACCESS' error which is likely to do with insufficient permissions. Try changing the owner of your project directory like so:

    sudo chown -R user:user /Users/user/Projects/MyIonicProject
    

    then:

    npm i -D -E @ionic/app-scripts