首页 文章

我在运行我的Ionic应用程序时遇到错误

提问于
浏览
0

在我的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这个项目 . 此命令需要此程序包才能正常运行 .
?安装@ 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!不行构建失败,错误代码:1 npm ERR!代码ELIFECYCLE npm ERR!错误1 npm ERR! node-sass@4.9.0 postinstall:node scripts / build.js npm ERR!退出状态1 npm ERR!错误的ERR!在post-sass@4.9.0 postinstall脚本失败 . 错误的ERR!这可能不是npm的问题 . 上面可能有额外的日志记录输出 . 错误的ERR!可以在以下位置找到此运行的完整日志:npm ERR! /Users/user/.npm/_logs/2018-09-21T07_51_45_171Z-debug.log [错误]运行子进程npm时发生错误 . npm i -D -E @ ionic / app-scripts退出,退出代码为1 .

使用--verbose标志重新运行此命令可能会提供更多
信息 .

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

1 回答

  • 0

    您收到“EACCESS”错误,这可能与权限不足有关 . 尝试更改项目目录的所有者,如下所示:

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

    然后:

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

相关问题