在我的Mac中,运行命令> sudo ionic serve 后,我得到-:
ionic-app-scripts提供--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错误!电脑 /用户/用户/项目/ MyIonicProject / node_modules / node-sass gyp错误! 节点-v v10.1.0 gyp ERR! node-gyp -v v3.8.0 gyp错误!不好Build 失败,错误代码:1 npm ERR!代码ELIFECYCLE npm ERR! errno 1 npm ERR! node-sass@4.9.0后安装:
node scripts/build.js
npm ERR! 退出状态1 npm ERR! npm ERR!在node-sass@4.9.0失败 安装后脚本。 npm ERR! npm可能不是问题。 上面可能还有其他日志记录输出。npm错误!有关此运行的完整日志,请参见:npm ERR!
/Users/user/.npm/_logs/2018-09-21T07_51_45_171Z-debug.log [ERROR]运行子流程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,但是它对我没有用,请帮助我
答案 0 :(得分:0)
您收到“ EACCESS”错误,这可能与权限不足有关。尝试像这样更改项目目录的所有者:
sudo chown -R user:user /Users/user/Projects/MyIonicProject
然后:
npm i -D -E @ionic/app-scripts