ProgressNS / sidekick-feedback

This repository is for feedback regarding NativeScript Sidekick. Use the issues system here to submit feature requests or vote for existing ones.
45 stars 9 forks source link

Cloud build for iOS fails with 'operation not permitted, mkdir' #288

Open maganius opened 6 years ago

maganius commented 6 years ago

Please, provide the details below:

Did you verify whether this issue has already been reported here?

Yes

Tell us about the problem

My iOS cloud build fails with the message Error: EPERM: operation not permitted, mkdir '/Users/builder/.electron

Which platform(s) does the issue occur on?

iOS (Cloud build) - local build not tested macOS

Provide the following version numbers that the issue occurs with:

Tell us how to recreate the issue in as much detail as possible

  1. Start a cloud build for iOS, it can be a fresh app.

Does this issue happen every time?

Yes

Send the client logs

https://gist.github.com/maganius/b611c630c0dfac347ec802023d1a666f

ggarabedian commented 6 years ago

@maganius, your project (or the template or seed that you have used as a base) seems to contain the electron framework and during build, its postinstall script is trying to download files to the /Users/builder/.electron folder, which is not allowed due to security reasons.

I am not sure what your particular scenario is (perhaps you are developing a project that is shared between web and mobile), but for the time being, to build such app, you will have to configure your environment and build locally.

I hope this is of any help.

cfjedimaster commented 6 years ago

FYI, I'm having the same issue. It is with a NS/Vue project and definitely (afaik) nothing Electron related.

ggarabedian commented 6 years ago

@cfjedimaster, I am inclined to agree with you that the issue is not related to Electron, because @maganius has also stated that the problem occurs with a fresh project as well. Unfortunately, we cannot reproduce the error when testing with neither of the two NS/Vue (or any other for that matter) templates.

To investigate this further, @cfjedimaster can you please tell me if you are running Sidekick on Windows or macOS and what are the versions of Node and NPM you have installed. @maganius, it would help if you can share the Node and NPM versions installed on your machine as well.

maganius commented 6 years ago

@ggarabedian npm version: 6.4.1 node version: v8.12.0

im trying build cloud using a mac with ns vue, the same error is if i try create a fresh app from sidekick with Project type Vue and template Master-Detail (with firebase)

cfjedimaster commented 6 years ago

@ggarabedian I'm running Sidekick on Windows 10. Node is 10.11.0. npm is 6.4.1.

ggarabedian commented 5 years ago

@maganius and @cfjedimaster, thank you for sharing more information about your environments. Unfortunately, we are still not able to reproduce the reported issue in Sidekick when testing with a newly created app based on the Blank or Master-Detail Vue.js templates.

We were able to recreate the error only with the vue-cli-template, which depends on the @vue/devtools extension, which in turn brings the electron dependency. All tests with the Sidekick Vue.js templates produced a working app.

Having said that, we cannot offer many ideas due to the fact that we are not able to reproduce the problem locally, however, we suggest that you run the npm cache clear command to clean the local cache (which has a low probability to affect the cloud build result, but still might help) and then execute a Clean build.

cfjedimaster commented 5 years ago

Wait, you were able to reproduce it though, right? "We were able to recreate the error only with the vue-cli-template, which depends on the @vue/devtools extension, which in turn brings the electron dependency. All tests with the Sidekick Vue.js templates produced a working app." So can the app handle that somehow? I know I definitely did that so it answers my issue. Or heck, could I remove it from package.json as a temp fix?

ggarabedian commented 5 years ago

@cfjedimaster, the vue-cli-template is created for the NativeScript CLI and there are some major differences between it and the templates used in Sidekick (for starters, they don't have the devtools dependencies) . This is why we recommend the Sidekick templates for cloud builds. Nevertheless, as long as you have used the vue-cli-template as a base for your app and still have the @vue/devtools dependency, yes, you should be able to fix the issue by removing the devtools dependencies from the package.json file.

In general, here are the steps that should let you build your app in the cloud:

  1. Remove the @vue/devtools, nativescript-vue-devtools dependencies from the package.json file.
  2. Remove the following code from the main.js file:
    
    import VueDevtools from 'nativescript-vue-devtools'

if(TNS_ENV !== 'production') { Vue.use(VueDevtools) }


3. Delete the `platforms/ios` and `node_modules` folders.
4. Run a cloud build.
cfjedimaster commented 5 years ago

Ah cool, I'm happy to know the issue. Is this something the app could detect? It already parses the package.json, right? Are a 'product', are you saying the expectation is to not always support CLI built stuff?

douglas-pires commented 5 years ago

I just had the same problem and removing @vue/devtools and nativescript-vue-devtools worked for me. Thanks @ggarabedian

ggarabedian commented 5 years ago

@damndoug, I am glad to hear that the suggested approach resolved the issue with your app.

@cfjedimaster, it would be hard to implement a way for Sidekick to detect such issues before building the app (other than disallowing specific plugins for cloud builds). In this particular case, the only reason the cloud build fails is because the electron dependency is trying to write data in a forbidden folder. Otherwise, there is no reason for this dependency to break the build or the app itself.

As for your last question, on the contrary, the expectation is to have identical experience for both local and cloud builds so they can be interchangeable. The Vue.js templates are the only ones that have separate versions for the NativeScript CLI and Sidekick, and as mentioned above, with slight changes the CLI Vue.js template can work in Sidekick. On the other hand, the two Sidekick Vue.js templates will work out of the box in the CLI. All other templates (JavaScript, TypeScript and Angular) are identical for both Sidekick and NativeScript CLI.

cfjedimaster commented 5 years ago

@ggarabedian I agree that trying to cover every possible bad plugin would be an issue, but in this case it specifically came from the CLI and wouldn't that imply it's something people would run into? If the expectation is that I can create a NS/Vue app via the CLI and expect it work with Sidekick, and the template itself, not me, adds the electron stuff, than I think it is fair to expect Sidekick to handle it. (Ok, technically I'm the one who told the CLI to install devtools support, but you get my point.)

maganius commented 5 years ago

@ggarabedian yep!!! disabling vue-tools is a temporary fix!

ppritcha commented 5 years ago

@ggarabedian I ran into this exact same problem the first time I tried to use Sidekick to build an IOS app from my Windows 10 environment. I had to do some searching to find this bug report. Your statement that "The Vue.js templates are the only ones that have separate versions for the NativeScript CLI and Sidekick" makes sense, but this seems like a major issue that should be documented, with a very visible warning not to use the Nativescript CLI templates if you intend to later use Sidekick. I was expecting the seamless experience that the NativeScript and NativeScript-Vue sites advertise.

I don't know whether this is something that should be fixed in Sidekick or something that should be fixed in the NativeScript CLI templates, but it does need to be addressed somehow. I think it would require a dialog between the respective teams...how would that be initiated? I'd like to help, but I don't know the people involved.

ggarabedian commented 5 years ago

@cfjedimaster and @ppritcha, the NativeScript Vue.js story is community driven, as is the vue-cli-template. While we are happy to help the community and work hard on providing the best possible experience for people that rely on NativeScript and Vue.js to develop their applications, we are not owners of the specific template. I was planning to contact the template creator and recommend that he removes the problematic dependency, however, I noticed that it's already optional and not added to the project by default, only when the user chooses to do so. Furthermore, this won't resolve the issue for people that already have an app based on the template.

And the issue in this case is not so much related to the template or the problematic module it contains, just as it's not caused by a difference in behavior between the CLI and Sidekick. Both follow the same process, however, when building locally, one has complete access to his environment and when building in the cloud, there are certain security limitations - for example, the app cannot right data to random locations. Having said that, it's not a matter of "fixing" the CLI or Sidekick, but allowing data to be written to this specific location, which is something we still investigate.

Still, I agree with both of you - there should be a more descriptive error message or some other means of informing the user about the issue and how to resolve it. But I don't think that we are ready to start parsing the package.json and "blacklist" specific plugins, yet. This said, I would welcome any other suggestions you might have. :)

Finally, I would also like to note that the template-blank-vue and template-master-detail-vue are created and supported by the NativeScript team and are designed to work both with the NativeScript CLI and Sidekick.