halfnelson / svelte-native

Svelte controlling native components via Nativescript
MIT License
1.82k stars 78 forks source link

ReferenceError: navigator is not defined #312

Open eunos-1128 opened 2 years ago

eunos-1128 commented 2 years ago

After ns preview I got this message and could not see the preview.

@halfnelson Can you investigate this problem?

ReferenceError: navigator is not defined
    at standardBrowserEnv (file:///var/mobile/Containers/Data/Application/5145D892-1D78-4984-B2AB-6D78652D5C96/Library/preview/vendor.js:48608:41)
    at Object../node_modules/axios/lib/helpers/isURLSameOrigin.js (file:///var/mobile/Containers/Data/Application/5145D892-1D78-4984-B2AB-6D78652D5C96/Library/preview/vendor.js:48657:7)
    at webpack_require (file:///var/mobile/Containers/Data/Application/5145D892-1D78-4984-B2AB-6D78652D5C96/Library/preview/runtime.js:28:33)
    at fn (file:///var/mobile/Containers/Data/Application/5145D892-1D78-4984-B2AB-6D78652D5C96/Library/preview/runtime.js:231:21)
    at Object../node_modules/axios/lib/adapters/xhr.js (file:///var/mobile/Containers/Data/Application/5145D892-1D78-4984-B2AB-6D78652D5C96/Library/preview/vendor.js:47307:23)
    at webpack_require (file:///var/mobile/Containers/Data/Application/5145D892-1D78-4984-B2AB-6D78652D5C96/Library/preview/runtime.js:28:33)
    at fn (file:///var/mobile/Containers/Data/Application/5145D892-1D78-4984-B2AB-6D78652D5C96/Library/preview/runtime.js:231:21)
    at getDefaultAdapter (file:///var/mobile/Containers/Data/Application/5145D892-1D78-4984-B2AB-6D78652D5C96/Library/preview/vendor.js:48255:15)
    at Object../node_modules/axios/lib/defaults.js (file:///var/mobile/Containers/Data/Application/5145D892-1D78-4984-B2AB-6D78652D5C96/Library/preview/vendor.js:48286:12)
    at webpack_require (file:///var/mobile/Containers/Data/Application/5145D892-1D78-4984-B2AB-6D78652D5C96/Library/preview/runtime.js:28:33)

This is the package.json I use.

{
  "name": "myapp",
  "main": "app/app.ts",
  "version": "1.0.0",
  "private": true,
  "dependencies": {
    "@nativescript/core": "~8.3.0",
    "@nativescript/theme": "^3.0.2",
    "assert": "^2.0.0",
    "axios": "^0.21.4",
    "browserify-zlib": "^0.2.0",
    "buffer": "^6.0.3",
    "https-browserify": "^1.0.0",
    "moment": "^2.29.1",
    "nativescript-social-share": "^1.6.0",
    "net": "^1.0.2",
    "os-browserify": "^0.3.0",
    "punycode": "^2.1.1",
    "q": "^1.5.1",
    "qs": "^6.11.0",
    "spotify-web-api-js": "^1.5.1",
    "stream-browserify": "^3.0.0",
    "stream-http": "^3.2.0",
    "svelte-hmr": "^0.14.12",
    "svelte-native": "~1.0.0",
    "tty-browserify": "^0.0.1",
    "url": "^0.11.0"
  },
  "devDependencies": {
    "@nativescript/preview-cli": "1.0.1",
    "@nativescript/types": "~8.3.0",
    "@nativescript/webpack": "~5.0.6",
    "svelte": "~3.44.0",
    "svelte-loader": "^3.1.2",
    "svelte-native-preprocessor": "^1.0.0",
    "svelte-preprocess": "^4.7.0",
    "typescript": "~4.5.5"
  }
}