首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >安装节点-sass目录时,离子教程失败

安装节点-sass目录时,离子教程失败
EN

Stack Overflow用户
提问于 2018-08-08 03:01:11
回答 1查看 684关注 0票数 0

我正试图通过运行以下命令(如详细的在他们的文档中的教程页面上 )在我的系统上运行Ionic教程:

代码语言:javascript
复制
sudo ionic start MyIonicProject tutorial

但是,当教程试图在MyIonicProject中构建节点-sass目录时总是失败的:

代码语言:javascript
复制
gyp verb build dir attempting to create "build" dir: /Users/macdad/MyIonicProject/node_modules/node-sass/build
gyp ERR! configure error 
gyp ERR! stack Error: EACCES: permission denied, mkdir '/Users/macdad/MyIonicProject/node_modules/node-sass/build'
gyp ERR! System Darwin 17.5.0
gyp ERR! command "/usr/local/bin/node" "/Users/macdad/MyIonicProject/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
gyp ERR! cwd /Users/macdad/MyIonicProject/node_modules/node-sass
gyp ERR! node -v v8.11.3
gyp ERR! node-gyp -v v3.7.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/macdad/.npm/_logs/2018-08-02T01_58_32_378Z-debug.log
[ERROR] An error occurred while running subprocess npm.

        npm i exited with exit code 1.

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

当它试图在node-sass/build目录中构建时,权限被拒绝--但是我如何对一个还不存在的目录设置权限呢?以前的错误在调用mkdir时输出以下内容:

Error: EACCES: permission denied, mkdir '/Users/imacuser/MyIonicProject/node_modules/node-sass/vendor'

父目录具有读/写权限。我在网上看到这个问题有不同的变化,但我找不到任何明确的答案。当您无法运行主教程时,很难学习框架。感谢你能在这里给新人的任何帮助。

编辑:在将读/写权限应用于所有封闭项之后,添加@ZearaeZ建议的两个命令的完整结果。构建仍然失败:

代码语言:javascript
复制
MacBook-Pro-6:~ macdad$ sudo npm rebuild node-sass --force
npm WARN using --force I sure hope you know what you are doing.
MacBook-Pro-6:~ macdad$ sudo ionic start MyIonicProject
? ./MyIonicProject exists. Overwrite? Yes

Let's pick the perfect starter template! 

Starter templates are ready-to-go Ionic apps that come packed with everything 
you need to build your app. To bypass this prompt next time, supply template, 
the second argument to ionic start.

? Starter template: tabs
✔ Preparing directory ./MyIonicProject - done!
✔ Downloading and extracting tabs starter - done!
? Integrate your new app with Cordova to target native iOS and Android? Yes
> ionic integrations enable cordova --quiet
✔ Downloading integration cordova - done!
✔ Copying integrations files to project - done!
[OK] Integration cordova added!

Installing dependencies may take several minutes.

     ✨   IONIC  DEVAPP   ✨

 Speed up development with the Ionic DevApp, our fast, on-device testing mobile app

  -     Test on iOS and Android without Native SDKs
  -     LiveReload for instant style and JS updates

 -->    Install DevApp: https://bitly/ionic-dev-app    <--

────────────────────────────────────────────────────────────

> npm i
npm WARN deprecated browserslist@2.11.3: Browserslist 2 could fail on reading Browserslist >3.0 config used in other tools.

> fsevents@1.2.4 install /Users/macdad/MyIonicProject/node_modules/fsevents
> node install

[fsevents] Success: "/Users/macdad/MyIonicProject/node_modules/fsevents/lib/binding/Release/node-v57-darwin-x64/fse.node" already installed
Pass --update-binary to reinstall or --build-from-source to recompile

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

Unable to save binary /Users/macdad/MyIonicProject/node_modules/node-sass/vendor/darwin-x64-57 : { Error: EACCES: permission denied, mkdir '/Users/macdad/MyIonicProject/node_modules/node-sass/vendor'
    at Object.fs.mkdirSync (fs.js:885:18)
    at sync (/Users/macdad/MyIonicProject/node_modules/mkdirp/index.js:71:13)
    at Function.sync (/Users/macdad/MyIonicProject/node_modules/mkdirp/index.js:77:24)
    at checkAndDownloadBinary (/Users/macdad/MyIonicProject/node_modules/node-sass/scripts/install.js:114:11)
    at Object.<anonymous> (/Users/macdad/MyIonicProject/node_modules/node-sass/scripts/install.js:157:1)
    at Module._compile (module.js:652:30)
    at Object.Module._extensions..js (module.js:663:10)
    at Module.load (module.js:565:32)
    at tryModuleLoad (module.js:505:12)
    at Function.Module._load (module.js:497:3)
  errno: -13,
  code: 'EACCES',
  syscall: 'mkdir',
  path: '/Users/macdad/MyIonicProject/node_modules/node-sass/vendor' }

> uglifyjs-webpack-plugin@0.4.6 postinstall /Users/macdad/MyIonicProject/node_modules/uglifyjs-webpack-plugin
> node lib/post_install.js


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

Building: /usr/local/bin/node /Users/macdad/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/macdad/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@8.11.3 | 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/macdad/MyIonicProject/node_modules/which/which.js:13:12)
gyp verb `which` failed     at F (/Users/macdad/MyIonicProject/node_modules/which/which.js:68:19)
gyp verb `which` failed     at E (/Users/macdad/MyIonicProject/node_modules/which/which.js:80:29)
gyp verb `which` failed     at /Users/macdad/MyIonicProject/node_modules/which/which.js:89:16
gyp verb `which` failed     at /Users/macdad/MyIonicProject/node_modules/isexe/index.js:42:5
gyp verb `which` failed     at /Users/macdad/MyIonicProject/node_modules/isexe/mode.js:8: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 (/Users/macdad/MyIonicProject/node_modules/which/which.js:13:12)
gyp verb `which` failed     at F (/Users/macdad/MyIonicProject/node_modules/which/which.js:68:19)
gyp verb `which` failed     at E (/Users/macdad/MyIonicProject/node_modules/which/which.js:80:29)
gyp verb `which` failed     at /Users/macdad/MyIonicProject/node_modules/which/which.js:89:16
gyp verb `which` failed     at /Users/macdad/MyIonicProject/node_modules/isexe/index.js:42:5
gyp verb `which` failed     at /Users/macdad/MyIonicProject/node_modules/isexe/mode.js:8:5
gyp verb `which` failed     at FSReqWrap.oncomplete (fs.js:152:21)
gyp verb `which` failed   stack: 'Error: not found: python2\n    at getNotFoundError (/Users/macdad/MyIonicProject/node_modules/which/which.js:13:12)\n    at F (/Users/macdad/MyIonicProject/node_modules/which/which.js:68:19)\n    at E (/Users/macdad/MyIonicProject/node_modules/which/which.js:80:29)\n    at /Users/macdad/MyIonicProject/node_modules/which/which.js:89:16\n    at /Users/macdad/MyIonicProject/node_modules/isexe/index.js:42:5\n    at /Users/macdad/MyIonicProject/node_modules/isexe/mode.js:8:5\n    at FSReqWrap.oncomplete (fs.js:152: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: 8.11.3
gyp verb command install [ '8.11.3' ]
gyp verb install input version string "8.11.3"
gyp verb install installing version: 8.11.3
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.11.3
gyp verb build dir attempting to create "build" dir: /Users/macdad/MyIonicProject/node_modules/node-sass/build
gyp ERR! configure error 
gyp ERR! stack Error: EACCES: permission denied, mkdir '/Users/macdad/MyIonicProject/node_modules/node-sass/build'
gyp ERR! System Darwin 17.5.0
gyp ERR! command "/usr/local/bin/node" "/Users/macdad/MyIonicProject/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
gyp ERR! cwd /Users/macdad/MyIonicProject/node_modules/node-sass
gyp ERR! node -v v8.11.3
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/macdad/.npm/_logs/2018-08-09T13_25_52_106Z-debug.log
[ERROR] An error occurred while running subprocess npm.

        npm i exited with exit code 1.

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

正如我所建议的那样,我不能对该目录拥有权限是有意义的,因为node-sass目录是在运行时创建的,如果没有自动读取/写入权限,如果它们不存在,就很难添加它们。

EN

回答 1

Stack Overflow用户

发布于 2018-08-08 04:54:51

首先,您需要为用户和组分配权限。

  1. 选择磁盘、文件夹或文件,然后选择file > Get Info。
  2. 单击锁定图标解锁,然后输入管理员名称和密码。
  3. 在Name列中单击某个用户或组,然后从弹出菜单中选择一个特权设置,并给予读写权限。
  4. 单击“动作”弹出菜单(Crog ),然后选择“应用于封闭项”。

在向目录应用权限之后,请在项目目录中运行此命令。

代码语言:javascript
复制
sudo npm rebuild node-sass --force

它将强制重建项目目录中的节点-sass。

票数 1
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/51738048

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档