GeekyAnts / vue-native-cli

Write Native Mobile Apps using Vue. Vue Native is a wrapper around React Native APIs
92 stars 21 forks source link

Error init project in docker container: no such file or directory, open 'app.json' #35

Closed s3bul closed 3 years ago

s3bul commented 5 years ago

I try install app in docker container, but i got error:

Can't read JSON file: /root/work/test/app.json
└─ Cause: Error: ENOENT: no such file or directory, open '/root/work/test/app.json'

I run this commands:

Next after set name and use yarn to install, i got the error.

Any tips?

RishabhKarnad commented 5 years ago

@s3bul What do you see when you list the contents of the test directory?

s3bul commented 5 years ago
~/work/test # ls -al
total 112
drwxr-xr-x    4 root     root          4096 Sep  6 00:17 .
drwxr-xr-x    3 root     root          4096 Sep  6 00:17 ..
-rw-r--r--    1 node     1002            12 Oct  4  2013 .npmignore
-rw-r--r--    1 node     1002            67 Oct  4  2013 README.md
-rw-r--r--    1 node     1002         21639 Oct  4  2013 blank.js
-rw-r--r--    1 node     1002           121 Oct  4  2013 bower.json
-rw-r--r--    1 root     root           609 Sep  6 00:17 metro.config.js
drwxr-xr-x  125 root     root          4096 Sep  6 00:17 node_modules
-rw-r--r--    1 node     1002           684 Sep  6 00:17 package.json
drwxr-xr-x    2 root     root          4096 Sep  6 00:17 tests
-rw-r--r--    1 node     1002          1089 Oct  4  2013 tests.js
-rw-r--r--    1 root     root          1389 Sep  6 00:17 vueTransformerPlugin.js
-rw-r--r--    1 root     root         42075 Sep  6 00:17 yarn.lock
archagy commented 4 years ago

I'm having the same issue with windows 10.

If I run it with git bash I have the next error

> $ vue-native init initTest
> Using globally installed expo-cli 3.0.10
> 
> Creating Vue Native project initTest
> 
> - Creating project with expo-cli
> 
> [18:50:01] --name: argument is required in non-interactive mode.
> √ Created project with expo-cli
> 
> (node:2924) UnhandledPromiseRejectionWarning: Error: ENOENT: no such file or directory, chdir 'C:\Users\traevr\projects\personal' -> 'initTest'
>     at process.chdir (internal/process/main_thread_only.js:29:13)
>     at installPackages (C:\Users\traevr\AppData\Local\Yarn\Data\global\node_modules\vue-native-cli\src\index.js:182:11)
>     at createExpoProject (C:\Users\traevr\AppData\Local\Yarn\Data\global\node_modules\vue-native-cli\src\index.js:123:3)
>     at init (C:\Users\traevr\AppData\Local\Yarn\Data\global\node_modules\vue-native-cli\src\index.js:101:5)
>     at Command.<anonymous> (C:\Users\traevr\AppData\Local\Yarn\Data\global\node_modules\vue-native-cli\src\index.js:69:7)
>     at Command.listener (C:\Users\traevr\AppData\Local\Yarn\Data\global\node_modules\commander\index.js:315:8)
>     at Command.emit (events.js:209:13)
>     at Command.parseArgs (C:\Users\traevr\AppData\Local\Yarn\Data\global\node_modules\commander\index.js:651:12)
>     at Command.parse (C:\Users\traevr\AppData\Local\Yarn\Data\global\node_modules\commander\index.js:474:21)
>     at Object.<anonymous> (C:\Users\traevr\AppData\Local\Yarn\Data\global\node_modules\vue-native-cli\src\index.js:81:9)
> (node:2924) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting
> a promise which was not handled with .catch(). (rejection id: 1)
> (node:2924) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a
>  non-zero exit code.

and when I use powershell I could get the project folder but with the same error of the app.json

√ Installed Vue Native devDependencies

(node:8584) UnhandledPromiseRejectionWarning: Error: ENOENT: no such file or directory, open 'app.json'
    at Object.openSync (fs.js:451:3)
    at Object.readFileSync (fs.js:353:35)
    at setupVueNativeApp (C:\Users\traevr\AppData\Local\Yarn\Data\global\node_modules\vue-native-cli\src\index.js:295:35)
    at createExpoProject (C:\Users\traevr\AppData\Local\Yarn\Data\global\node_modules\vue-native-cli\src\index.js:124:9)
    at init (C:\Users\traevr\AppData\Local\Yarn\Data\global\node_modules\vue-native-cli\src\index.js:101:5)
    at Command.<anonymous> (C:\Users\traevr\AppData\Local\Yarn\Data\global\node_modules\vue-native-cli\src\index.js:69:7)
    at Command.listener (C:\Users\traevr\AppData\Local\Yarn\Data\global\node_modules\commander\index.js:315:8)
    at Command.emit (events.js:209:13)
    at Command.parseArgs (C:\Users\traevr\AppData\Local\Yarn\Data\global\node_modules\commander\index.js:651:12)
    at Command.parse (C:\Users\traevr\AppData\Local\Yarn\Data\global\node_modules\commander\index.js:474:21)
(node:8584) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). (rejection id: 2)
(node:8584) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Project Structure

initTest
├── blank.js
├── bower.json
├── metro.config.js
├── node_modules
├── package.json
├── README.md
├── tests
├── tests.js
├── vueTransformerPlugin.js
└── yarn.lock

package.json

{
  "name": "blank",
  "version": "0.1.22",
  "description": "Common js functions library",
  "main": "blank.js",
  "directories": {
    "test": "tests"
  },
  "scripts": {
    "test": "node tests.js"
  },
  "repository": {
    "type": "git",
    "url": "https://github.com/rumkin/blank-js.git"
  },
  "keywords": [
    "library",
    "framework",
    "common"
  ],
  "author": "Pasha Rumkin <dev@rumk.in>",
  "license": "BSD",
  "bugs": {
    "url": "https://github.com/rumkin/blank-js/issues"
  },
  "dependencies": {
    "vue-native-core": "0.1.3",
    "vue-native-helper": "0.1.3"
  },
  "devDependencies": {
    "@babel/core": "7.5.0",
    "vue-native-scripts": "0.1.3"
  }
}
archagy commented 4 years ago

Okay, I tried to run the init project at home with my mac and I don't have any problem the init works perfect. Maybe it could be a proxy problem from my work network or some incompatibility with windows 10.

I will try later to run it on a windows VM.

ChrisKader commented 4 years ago

This is a very common issue when behind a firewall/proxy that is not configured to handle X-Content-Type-Options correctly.

Basically, GH is serving up the mime-type as text or "not JSON" and that header is supposed to inform proxies that it is still okay. I have recently ran into this issue at work and worked with our IS teams to resolve it versus having to whitelist each JSON URL we needed. I recommend doing something like a wget or curl to the app.json that is distributed on GH and used when generating an app from vue-native init to see the actual reason for it not being downloaded/blocked.

officialpiyush commented 4 years ago

+1 - Can Reproduce this error on WIndows 10

Saganic commented 4 years ago

+1 macOS Catalina 10.15 (19A583)

EDIT: Fixed in Catalina by removing expo-cli and vue-native-cli globals, updating npm global default directory and re-installing both packages. Appears to be a permission issue in expo-cli when upgrading from Mojave.

s3bul commented 3 years ago

I try install app in docker container, but i got error:

Can't read JSON file: /root/work/test/app.json
└─ Cause: Error: ENOENT: no such file or directory, open '/root/work/test/app.json'

I run this commands:

* `docker run -ti --rm node:10.16-alpine sh`

* `yarn global add react-native-cli expo-cli vue-native-cli`

* `mkdir ~/work && cd ~/work && vue-native init test`

Next after set name and use yarn to install, i got the error.

Any tips?

Now it's working.

Of course when I use newer node image, e.g. 10.22.1-alpine