0

我是 Mac、macOS 开发和 NativeScript 的新手。

我正在尝试使用以下方法开始一个新的 tns 项目:

sudo tns create rsrpt --ng

我一直收到这个错误:

Error: EACCES: permission denied, mkdir '/Users/myUser/code/rsrpt/hooks'

出于沮丧,10 小时后,我运行了以下命令:

sudo chown -R $(whoami) ~/.local

甚至这个:(我希望我没有破坏这台mac的权限)

sudo chown -R $(whoami) ~/

但没有任何帮助。我仍然收到附加的详细错误。任何有关如何克服此权限问题的帮助将不胜感激!谢谢!

> nativescript-angular@6.1.0 postinstall /Users/myUser/code/rsrpt/node_modules/nativescript-angular
> node postinstall.js

fs.js:885
  return binding.mkdir(pathModule._makeLong(path),
                 ^

Error: EACCES: permission denied, mkdir '/Users/myUser/code/rsrpt/hooks'
    at Object.fs.mkdirSync (fs.js:885:18)
    at Object.<anonymous> (/Users/myUser/code/rsrpt/node_modules/nativescript-angular/postinstall.js:11:12)
    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)
    at Function.Module.runMain (module.js:693:10)
    at startup (bootstrap_node.js:191:16)
    at bootstrap_node.js:612:3
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! nativescript-angular@6.1.0 postinstall: `node postinstall.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the nativescript-angular@6.1.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/myUser/.npm/_logs/2018-08-14T00_22_47_432Z-debug.log
Command npm install failed with exit code 1
# tns create

┌───────────────┬────────────────────────────────────────────────────────────┐
│ Usage         │ Synopsis                                                   │
│ Create from   │ $ tns create <App Name> [--path <Directory>] [--appid <App │
│ default       │ ID>]                                                       │
│ JavaScript    │                                                            │
│ template      │                                                            │
│ Create from   │ $ tns create <App Name> --template typescript [--path      │
│ default       │ <Directory>] [--appid <App ID>] OR $ tns create <App Name> │
│ TypeScript    │ --tsc [--path <Directory>] [--appid <App ID>] OR $         │
│ template      │ tns create <App Name> --template tsc [--path <Directory>]  │
│               │ [--appid <App ID>]                                         │
│ Create from   │ $ tns create <App Name> --template angular [--path         │
│ default       │ <Directory>] [--appid <App ID>] OR $ tns create <App Name> │
│ Angular       │ --template ng [--path <Directory>] [--appid <App ID>]      │
│ template      │ OR $ tns create <App Name> --ng [--path <Directory>] [-    │
│               │ -appid <App ID>]                                           │
│ Copy from     │ $ tns create <App Name> [--path <Directory>] [--appid <App │
│ existing      │ ID>]                                                       │
│ project       │                                                            │
│ Create from   │ $ tns create <App Name> [--path <Directory>] [--appid <App │
│ custom        │ ID>] --template <Template>                                 │
│ template      │                                                            │
└───────────────┴────────────────────────────────────────────────────────────┘

Creates a new project for native development with NativeScript.

### Options

    * --path - Specifies the directory where you want to create the project, if different from the current directory. The directory must be empty.
    * --appid - Sets the application identifier for your project.
    * --template - Specifies a valid npm package which you want to use to create your project. If --template is not set, the NativeScript CLI creates the project from the default JavaScript hello-world template.
    * --ng - Sets the template for your project to the Angular template.
    * --tsc - Sets the template for your project to the TypeScript template.

### Attributes

    * <App Name> is the name of project. The specified name must meet the requirements of all platforms that you want to target. For more information about the <App Name> requirements, run $ tns help create
    * <App ID> is the application identifier for your project. It must be a domain name in reverse and must meet the requirements of all platforms that you want to target. If not specified, the application identifier is set to org.nativescript.<App name> For more information about the <App ID> requirements, run $ tns help create
4

1 回答 1

1

你试过“tns医生”吗?我不确定它是在检查权限还是权限规则。您是否尝试过另一个目录?也许你需要重新安装 complate(npm&nativescript)

于 2018-08-27T12:12:43.980 回答