我刚刚创建了一个反应应用程序。看起来npm start工作正常,但npm run build经常失败。我需要运行npm run build以将其部署在某个网站上。
已经浏览了 上与此相关的所有帖子stackoverflow.com。但没有找到任何可行的解决方案。
import './App.css';
import 'https://kit.fontawesome.com/a076d05399.js'
import Navbar from './components/navbar';
import Homepage from './components/homepage';
import Skills from './components/Skills';
import Project from './components/project';
import Contact from './components/contact';
Run Code Online (Sandbox Code Playgroud)
错误信息
Failed to compile.
The target environment doesn't support dynamic import() syntax so it's not possible to use external type 'module' within a script
Run Code Online (Sandbox Code Playgroud) 实际上这段代码在“DEV C++”中运行良好,但是当我将它放入我的“Hacker-Rank”面板时,它给出了这个错误“对函数的引用不明确”,尽管所有在线编译器都给出了错误......
我不认为这里的函数重载是中断的地方,因为这个错误主要来自函数重载。
#include <bits/stdc++.h>
#include <cstdio>
#include<iostream>
using namespace std;
int function(int n);
int main()
{
int n;
cin >> n;
cin.ignore(numeric_limits<streamsize>::max(), '\n');
if(n<=0){
return(0);
}
else{
function(n);
}
}
int function(int n)
{
if (n<=9)
{
cout<<"experiment";
}
else{
cout<<"Greater than 9";
}
return 0;
}
Run Code Online (Sandbox Code Playgroud)
<source>:20:9: error: reference to 'function' is ambiguous
function(n);
^
<source>:8:5: note: candidate found by name lookup is 'function'
int function(int n);
^
/opt/compiler-explorer/gcc-snapshot/lib/gcc/x86_64-linux-gnu/11.0.0/../../../../include/c++/11.0.0/bits/std_function.h:111:11: note: candidate found by name lookup …Run Code Online (Sandbox Code Playgroud) 我不明白为什么只为第一个字符串strlen()给出错误的值(即9:)。之后,值正确出现。
#include <stdio.h>
#include <string.h>
int main() {
int m, i, j;
i = 2;
j = 5;
char a[i][j];
for (i = 0; i <= 2; i++) {
scanf("%s", a[i]);
}
m = strlen(a[0]);
printf("%d\n", m); //here the problem is coming//
m = strlen(a[1]);
printf("%d\n", m);
m = strlen(a[2]);
printf("%d\n", m);
return 0;
}
Run Code Online (Sandbox Code Playgroud)
输入:
heyman
jack
bro
Run Code Online (Sandbox Code Playgroud)
输出:
9
4
3
Run Code Online (Sandbox Code Playgroud) (据我所知)C++ 不接受头文件上的“.h”扩展名(因为它通常不存在于其他包含语句中)所以包含如何<bits/stdc++.h>在 C++ 中工作以及为什么它有“.h”延期?
c++ ×2
ambiguous ×1
c ×1
function ×1
header-files ×1
import ×1
input ×1
javascript ×1
name-lookup ×1
namespaces ×1
reactjs ×1
strlen ×1
webpack ×1