我的 Ionic 应用程序 运行 出现错误

I am getting error in running my Ionic Application

在我的 mac 中 运行 命令 >sudo ionic serve 我得到 -:

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

[INFO] 看起来 @ionic/app-scripts 没有安装在这个项目中。

   This package is required for this command to work properly.

?安装@ionic/app-scripts?是

当我开始使用 cli 命令安装它时 > npm i -D -E @ionic/app-scripts 我得到-:

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$ 

如您所见,我在上面看到了错误,我将上面代码的一些错误部分放在下面,请仔细查看:

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.

我在这里遇到错误...并且无法 运行 我的离子应用程序,我也删除并重新安装了 npm,但它对我不起作用请帮助我

您收到 'EACCESS' 错误,这可能与权限不足有关。尝试像这样更改项目目录的所有者:

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

然后:

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