我刚刚创建了一个React App create-react-app aquastars
然后使用弹出依赖项yarn run eject
,当我运行应用程序时,我收到以下错误.
Cannot find module '@babel/plugin-transform-react-jsx-source'
Run Code Online (Sandbox Code Playgroud)
我什么都没做!要启动并运行,我需要做什么?任何帮助,将不胜感激.
在我的快速应用程序中运行以下代码时出现上述错误。当我去 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) 我正在尝试创建一个 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) 我想在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) 我几乎尝试了所有解决方案,但似乎没有一个有效。
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”,不存在
你如何让项目运行?
我正在尝试在图像周围换行,如果我使用以下代码:
<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中使用样式?
我正在组装一个小型 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)
任何帮助将不胜感激。
我正在使用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) 我试图用他们的最后一个字符对一系列单词进行排序.
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"
.
我想在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)
或者我可以使用替代数据类型吗?因为我在文档中没有看到任何货币价值.任何帮助,将不胜感激.
reactjs ×4
javascript ×2
ruby ×2
arrays ×1
babeljs ×1
emmet ×1
express ×1
homebrew ×1
html5 ×1
image ×1
json ×1
laravel-5.4 ×1
mobx-react ×1
node.js ×1
package.json ×1
php ×1
pug ×1
react-native ×1
schema ×1
sorting ×1