我在运行第一个离子项目时遇到问题

时间:2018-09-21 06:27:03

标签: ionic-framework ionic3

我正在使用Mac

我试图运行我的第一个离子项目,但是在Mac中运行它却遇到了错误

我将遵循的所有步骤放入终端-

  1. 从-开始:$ ionic开始MyIonicProject教程
  2. $ cd MyIonicProject
  3. $ ionic服务

然后我出错了

Error: EACCES: permission denied, open '/Users/user/.ionic/helper.log'
> 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
> 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
npm WARN checkPermissions Missing write access to /Users/user/Projects/MyIonicProject/node_modules
npm WARN checkPermissions Missing write access to /Users/user/Projects/MyIonicProject/node_modules/@ionic
npm ERR! path /Users/user/Projects/MyIonicProject/node_modules
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall access
npm ERR! Error: EACCES: permission denied, access '/Users/user/Projects/MyIonicProject/node_modules'
npm ERR!  { Error: EACCES: permission denied, access '/Users/user/Projects/MyIonicProject/node_modules'
npm ERR!   stack: 'Error: EACCES: permission denied, access \'/Users/user/Projects/MyIonicProject/node_modules\'',
npm ERR!   errno: -13,
npm ERR!   code: 'EACCES',
npm ERR!   syscall: 'access',
npm ERR!   path: '/Users/user/Projects/MyIonicProject/node_modules' }
npm ERR! 
npm ERR! The operation was rejected by your operating system.
npm ERR! It is likely you do not have the permissions to access this file as the current user
npm ERR! 
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator (though this is not recommended).

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/user/.npm/_logs/2018-09-21T06_24_56_379Z-debug.log
users-MacBook-Pro-3:MyIonicProject user$ 

2 个答案:

答案 0 :(得分:0)

尝试通过附加sudo来运行命令,如下所示:

sudo ionic serve


在终端窗口中运行以下命令:

sudo chown -R $USER /usr/local/

这将更改本地文件夹中所有内容的权限,然后尝试以下命令:

sudo ionic serve

答案 1 :(得分:0)

  

该项目中未安装类似@ ionic / app-scripts的

所以请先尝试:

npm install @ionic/app-scripts@latest --save-dev

然后:

npm install 

ionic serve -l