小编ken*_*try的帖子

运行 Angular 项目会出现 Node-sass 错误

我正在本地环境中运行一个角度项目,其版本如下。

\n
npm version : 6.9.0\nAngular CLI: 7.3.9\nNode: 10.16.0\nOS: win32 x64\n
Run Code Online (Sandbox Code Playgroud)\n

我无法运行项目并收到以下错误:

\n
    ERROR in ./src/assets/styles/style.scss (./node_modules/@angular-devkit/build-angular/src/angular-cli-files/plugins/raw-css-loader.js!./node_modules/postcss-loader/src??embedded!./node_modules/sass-loader/lib/loader.js??ref--14-3!./src/assets/styles/style.scss)\n    Module build failed (from ./node_modules/sass-loader/lib/loader.js):\n    Error: Cannot find module 'node-sass'\n        at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)\n        at Function.Module._load (internal/modules/cjs/loader.js:562:25)\n        at Module.require (internal/modules/cjs/loader.js:690:17)\n        at require (internal/modules/cjs/helpers.js:25:18)\n        at Object.sassLoader (..\\node_modules\\sass-loader\\lib\\loader.js:46:72)\n    ERROR in ./src/app/modules/shared/components/loader/loader.component.scss\n    Module build failed (from ./node_modules/sass-loader/lib/loader.js):\n    Error: Cannot find module 'node-sass'\n        at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)\n        at Function.Module._load (internal/modules/cjs/loader.js:562:25)\n        at Module.require (internal/modules/cjs/loader.js:690:17)\n        at require (internal/modules/cjs/helpers.js:25:18)\n        at Object.sassLoader (..\\node_modules\\sass-loader\\lib\\loader.js:46:72)\n    i \xef\xbd\xa2wdm\xef\xbd\xa3: Failed to compile.\n
Run Code Online (Sandbox Code Playgroud)\n

我也尝试过删除node_modules并重新安装

\n
\n …

node.js angular angular7

8
推荐指数
1
解决办法
1万
查看次数

react-native-router-flux 嵌套选项卡

我正在使用 react-native-router-flux 并且我正在尝试在选项卡内添加一个带有场景的选项卡栏,例如双选项卡栏之类的东西。它适用于iOS,但不适用于Android

<Router createReducer={reducerCreate}>
  <Scene key="tabbar" tabs={true} style={styles.tabBar}>
    <Scene key="tab0" title="nested" icon={TabIcon}>
      <Scene key="tabbar2" tabs={true} style={styles.tabBar} icon={TabIcon}>
        <Scene key="subtab1" title="subtab1" component={Results} icon={TabIconResults} initial={true} />
        <Scene key="subtab2" title="subtab2" component={Results} icon={TabIconResults}/>
        <Scene key="subtab3" title="subtab3" component={Results} icon={TabIconResults}/>
      </Scene>
    </Scene>                           
    <Scene key="tab1" component={TabView} title="Réservations" icon={TabIcon} />
    <Scene key="tab2" component={TabView} title="Compte" icon={TabIcon}/>     
  </Scene>
</Router>
Run Code Online (Sandbox Code Playgroud)

tabs react-native react-native-router-flux

5
推荐指数
0
解决办法
1297
查看次数

如何使用AWS-SDK Javascript获得EC2公共IP

我想使用aws-sdk for Javascript获得EC2实例的公共IP。执行以下代码后,返回给出{ Reservations: [] }

'use strict';

const AWS = require('aws-sdk');

AWS.config.loadFromPath('./aws.json');
AWS.config.update({ region: 'ap-northeast-1' });

const ec2 = new AWS.EC2({ apiVersion: '2016-11-15' });

const params = {
  Filters: [
    {
      Name: 'ip-address',
      Values: [
        'ip-address'
      ]
    }
  ],
  InstanceIds: [
    "i-0acf483a5cbdfdbeb"
  ]
};

ec2.describeInstances(params, function (err, data) {
  if (err) {
    console.log(err);
  }

  console.log(data);
});
Run Code Online (Sandbox Code Playgroud)

使用的凭据已在IAM上经过验证,并被允许访问EC2实例。为什么不能获取其公共IP?

节点:7.1.0

作业系统:CentOS 7.3 / Windows 10

amazon-ec2 node.js aws-sdk

5
推荐指数
1
解决办法
1155
查看次数

当权限设置更改时,使本机应用程序重新启动

我有一个 react native 应用程序,它在 Android 和 iOS 上都运行良好。通过“设置”选项更改任何权限(相机、存储)后,应用程序应重新启动。

例如,如果我在主屏幕上并更改了权限,应用程序将重新启动并将我带回登录屏幕。

是否有任何选项可以保持当前的应用程序状态(Android 和 iOS)?

请建议。

android ios react-native

5
推荐指数
1
解决办法
1289
查看次数

反应原生中的警告“任务孤立于请求”

嗨,有人知道警告的含义是什么:Task orphaned for request <NSMutableURLRequest:0x283e371a0> { URL: https:someurl }。网址是一张图片。谢谢

xcode react-native

5
推荐指数
0
解决办法
1346
查看次数

反应本机:RCCTFatal + 668

我也在 React Native github repo 中发布了这个问题,希望能对错误有所了解。

我注意到我的 iOS 用户中有不少在生产中遇到致命错误 (RCTFatal + 668),导致应用程序崩溃。每个会话发生大约 0.004 次错误,并不可怕,但也不是很好。

错误与用户运行的 iOS 版本之间似乎没有相关性,崩溃次数似乎与每个 iOS 版本的会话数直接相关。用户使用的 iOS 设备似乎也与错误无关。

我无法在本地、暂存或生产中重现错误。

有没有其他人遇到过这个错误,我该怎么做才能进一步调试这个问题?


反应本机信息

System:
  OS: macOS Mojave 10.14.6
  CPU: (8) x64 Intel(R) Core(TM) i7-7920HQ CPU @ 3.10GHz
  Memory: 189.93 MB / 16.00 GB
  Shell: 3.2.57 - /bin/bash

Binaries:
  Node: 12.8.0 - /usr/local/bin/node
  Yarn: 1.17.3 - /usr/local/bin/yarn
  npm: 6.4.1 - /usr/local/bin/npm
  Watchman: 4.9.0 - /usr/local/bin/watchman

SDKs:
  iOS SDK:
    Platforms: iOS 13.2, DriverKit 19.0, macOS 10.15, tvOS 13.2, watchOS 6.1
  Android …
Run Code Online (Sandbox Code Playgroud)

xcode ios react-native

5
推荐指数
0
解决办法
577
查看次数

有条件的内部地图 JSX

我想在地图内创建条件渲染。数据取自具有以下结构的 JSON 文件:

export const products = [   
            {
                "scores": {
                    "quality": 8,
                    "relevancy": {
                        "design": 3,
                        "code": 9,
                        "business": 5
                    }
                },
                "title": "AdCall: Bringing WebRTC to display ads",
                "subtitle": "The first advertising banner with video calls",
                "content": [
                    {
                        "type": "text",
                        "body": "AdCall is a concept for a new kind of online advertising banner. Using WebRTC, it allows for a click to call action with the aim of increasing conversions. It's built with a Node backend and deployed …
Run Code Online (Sandbox Code Playgroud)

json jsx reactjs

3
推荐指数
1
解决办法
7252
查看次数

npx pod 安装错误。正在中止运行并且遇到意外错误

当我成功安装 create-react-native-app 且没有出现错误时,出现了此警告,当我输入该警告时,终端给了我一个错误或警告,如下所示:An unexpected error was encountered. Please report it as a bug:

\n

有没有人收到此错误代码或类似的代码?请帮助我解决这个问题。

\n
\xe2\x9a\xa0\xef\xb8\x8f  Before running your app on iOS, make sure you have CocoaPods installed and initialize the project:\n\n  cd travel-app-react-native/ios\n  npx pod-install\n\noguzhanatalay@Oguzhans-Mac Desktop % cd travel-app-react-native \noguzhanatalay@Oguzhans-Mac travel-app-react-native % npx pod-install\nnpx: installed 1 in 6.118s\nScanning for pods...\n1.10.0\n> pod install\nInstalling unimodules:\n expo-constants@9.2.0 from ../node_modules/expo-constants/ios\n expo-error-recovery@1.3.0 from ../node_modules/expo-error-recovery/ios\n expo-file-system@9.2.0 from ../node_modules/expo-file-system/ios\n expo-font@8.3.0 from ../node_modules/expo-font/ios\n expo-image-loader@1.2.0 from ../node_modules/expo-image-loader/ios\n expo-keep-awake@8.3.0 from ../node_modules/expo-keep-awake/ios\n expo-linear-gradient@8.3.1 from ../node_modules/expo-linear-gradient/ios\n expo-location@9.0.1 from ../node_modules/expo-location/ios\n …
Run Code Online (Sandbox Code Playgroud)

macos npm react-native expo create-react-native-app

3
推荐指数
1
解决办法
4051
查看次数

在 react-native-map 中切换 maptype

我有与谷歌一起运行的 IOS 和 Android 的 react-native 地图。有没有办法mapType在 react-native expo 应用程序中启用像谷歌地图应用程序那样的图层切换器?以便用户可以切换地图类型(标准、卫星、....)

代码的简化版本

constructor(props) {
  super(props);
  this.state = {
    mapRegion: null,
    markers: [],
    mapType: null
  };
}

switchMapType() {
  console.log('Changing');
  this.state.mapType = 'satellite'
}

render() {
  return (
    <MapView
      provider="google"
      mapType={this.state.mapType}
    >
      <Icon
        onPress={this.switchMapType} 
      />
    </MapView>
  );
}
Run Code Online (Sandbox Code Playgroud)

state 内部时出现未定义错误switchMapType()

android ios react-native react-native-maps

2
推荐指数
1
解决办法
5367
查看次数

Nodejs swagger 自动生成集成

我需要使用 NodeJS 开发 API,还需要为 API 开发文档。我与 swagger auto-gen 集成来创建 swagger.json。但是如果我使用routes.js,则 swagger.json 无法正确生成,如下所示

    var express = require('express');

    module.exports = function(app) {
    var userController    = require('../controller/userController');
    var apiRouter = express.Router();
    var routerV1 = express.Router();
    var routerV2 = express.Router();

    app.use('/admin', apiRouter);
    apiRouter.use("/v1", routerV1);
    apiRouter.use("/v2", routerV2);
 
    routerV1.route('/users').get(userController.getUsersV1);    
    routerV2.route('/users').get(userController.getUsersV2);
     
   
 }
Run Code Online (Sandbox Code Playgroud)

并将这些routes.js映射到swagger.js中

请建议生成 swagger.js 的最佳方法

我们需要为所有控制器创建路由文件吗?

node.js swagger-codegen

2
推荐指数
1
解决办法
7627
查看次数