小编Alt*_*ian的帖子

运行React App时找不到模块'@ babel/plugin-transform-react-jsx-source'

我刚刚创建了一个React App create-react-app aquastars然后使用弹出依赖项yarn run eject,当我运行应用程序时,我收到以下错误.

Cannot find module '@babel/plugin-transform-react-jsx-source'
Run Code Online (Sandbox Code Playgroud)

我什么都没做!要启动并运行,我需要做什么?任何帮助,将不胜感激.

javascript reactjs

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

获取 RangeError [ERR_HTTP_INVALID_STATUS_CODE]:无效的状态代码:在 express 应用程序中未定义

在我的快速应用程序中运行以下代码时出现上述错误。当我去 localhost:3000/cards 时。

这是在我的cards.js 文件中。

const express = require('express');
const router = express.Router();
const { data } = require('../data/flashcardData.json');
const { cards } = data;

router.get('/', (req, res) => {
res.render('card', {
prompt: cards[0].question,
hint: cards[0].hint
 });
});

module.exports = router;
Run Code Online (Sandbox Code Playgroud)

这是我的 app.js 文件中的代码。

const express = require('express');
const bodyParser = require('body-parser');
const cookieParser = require('cookie-parser');

const app = express();

app.use(bodyParser.urlencoded({ extended: false }));
app.use(cookieParser());

 app.set('view engine', 'pug');

 const mainRoutes = require('./routes');
 const cardRoutes = require('./routes/cards');

 app.use(mainRoutes);
 app.use('/cards', cardRoutes);

 app.use((req, …
Run Code Online (Sandbox Code Playgroud)

javascript json express pug

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

错误 eslint@5.6.0:引擎“节点”与此模块不兼容。尝试创建反应应用程序时

我正在尝试创建一个 React 应用程序,但在我的控制台中出现以下错误。

Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts...

yarn add v1.10.1
info No lockfile found.
[1/4]   Resolving packages...
warning react-scripts > eslint > file-entry-cache > flat-cache > circular-   json@0.3.3: CircularJSON is in maintenance only, flatted is its successor.
[2/4]   Fetching packages...
error eslint@5.6.0: The engine "node" is incompatible with this module.    Expected version "^6.14.0 || ^8.10.0 || >=9.10.0". Got "9.5.0"
error Found incompatible module
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this …
Run Code Online (Sandbox Code Playgroud)

homebrew node.js

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

如何在ruby中使用哈希值获取默认值

我想在ruby中使用哈希时尝试获取默认值.查找文档,您使用了一个fetch方法.因此,如果未输入哈希,则默认为值.这是我的代码.

def input_students
  puts "Please enter the names and hobbies of the students plus country of    birth"
  puts "To finish, just hit return three times"

  #create the empty array
  students = []
  hobbies = []
  country = []
  cohort = []

  # Get the first name
  name = gets.chomp
  hobbies = gets.chomp
  country = gets.chomp
  cohort = gets.chomp

  while !name.empty? && !hobbies.empty? && !country.empty? && cohort.fetch(:cohort, january) do #This is to do with entering twice
    students << {name: name, hobbies: …
Run Code Online (Sandbox Code Playgroud)

ruby

5
推荐指数
2
解决办法
7854
查看次数

打印:条目,“:CFBundleIdentifier”,不存在已经尝试过大多数解决方案

我几乎尝试了所有解决方案,但似乎没有一个有效。

An error was encountered processing the command   (domain=NSPOSIXErrorDomain,   code=2):
Failed to install the requested application
An application bundle was not found at the provided path.
Provide a valid path to the desired application bundle.
Print: Entry, ":CFBundleIdentifier", Does Not Exist

Command failed: /usr/libexec/PlistBuddy -c Print:CFBundleIdentifier     build/Build/Products/Debug-iphonesimulator/albums.app/Info.plis      
Run Code Online (Sandbox Code Playgroud)

打印:条目,“:CFBundleIdentifier”,不存在

你如何让项目运行?

react-native

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

React error Line 18:样式属性值必须是一个对象react / style-prop-object

我正在尝试在图像周围换行,如果我使用以下代码:

<div className="container">
         <img src={myImageSource} alt="swimmer" height="300" width="300" style="float: left" />
         <p> This is where the other text goes about the swimmer</p>
 </div>
Run Code Online (Sandbox Code Playgroud)

现在,我知道这style="float: left"是html5。但是,如果我使用以下代码:

<div className="container">
         <img src={myImageSource} alt="swimmer" height="300" width="300" align="left" />
            <p> This is where the other text goes about the swimmer</p>
 </div>
Run Code Online (Sandbox Code Playgroud)

有用!为什么我不能在React中使用样式?

html5 image reactjs

5
推荐指数
3
解决办法
5483
查看次数

React 中的模块构建错误:编译 React App 时出现“未知插件“@babel/plugin-proposal-decorators”

我正在组装一个小型 React 应用程序并尝试将 MobX 合并到依赖项中。下面是 babel 的 package.json 设置。

"babel": {
"presets": [
  "@babel/preset-env",
  "react-app"
],
"plugins": [
  [
    "@babel/plugin-proposal-decorators",
    {
      "legacy": true
    }
  ],
  [
    "@babel/plugin-proposal-class-properties",
    {
      "loose": true
    }
   ]
 ]
},
"devDependencies": {
"@babel/plugin-proposal-decorators": "^7.1.2",
"babel-plugin-transform-decorators-legacy": "^1.3.5"
}
Run Code Online (Sandbox Code Playgroud)

启动服务器时出现的实际错误如下:

./src/index.js
Module build failed: ReferenceError: Unknown plugin "@babel/plugin-proposal- 
decorators" specified in 
"/Users/briankaty1/Desktop/mobx/aquastars/react_aquastars/package.json" at 0, 
attempted to resolve relative to 
"/Users/briankaty1/Desktop/mobx/aquastars/react_aquastars"
Run Code Online (Sandbox Code Playgroud)

任何帮助将不胜感激。

reactjs package.json babeljs mobx-react

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

尝试在vs代码中将emmet与React应用一起使用

我正在使用Visual Studio Code并创建一个React App。我了解Emsc随附Vsc,但不适用于我的React App。我尝试将以下代码放入设置中。

"emmet.includeLanguages": {
"javascript": "javascriptreact",
"xml": {
  "attr_quotes": "single"
 }
 },
"emmet.triggerExpansionOnTab": true,
Run Code Online (Sandbox Code Playgroud)

emmet reactjs visual-studio-code

4
推荐指数
4
解决办法
1545
查看次数

按最后一个字母对单词数组进行排序

我试图用他们的最后一个字符对一系列单词进行排序.

def array_sort_by_last_letter_of_word(array)
  list = array[-1,1]
  list.sort { |a,b| b <=> a }
end

puts array_sort_by_last_letter_of_word ['sky', 'puma', 'maker']
Run Code Online (Sandbox Code Playgroud)

我得到的输出就是"maker".

ruby arrays sorting

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

在laravel模式中为价格创建列

我想在laravel模式中创建一个价格列.

public function up()
{
    Schema::create('cameras', function (Blueprint $table) {
        $table->increments('id');
        $table->string('name');
        $table->string('condition');
        $table->string('price');
        $table->string('type');
        $table->timestamps();
    });
}
Run Code Online (Sandbox Code Playgroud)

或者我可以使用替代数据类型吗?因为我在文档中没有看到任何货币价值.任何帮助,将不胜感激.

php schema laravel-5.4

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