将'npm start'与'create-react-kotlin-app'创建的应用程序一起使用时出错

时间:2022-04-13 20:07:51

When trying to start up an app that was created by the command line tool 'create-react-kotlin-app' with 'npm start', I keep getting the following error:

当尝试启动由命令行工具'create-react-kotlin-app'和'npm start'创建的应用程序时,我不断收到以下错误:

kotlin-js failed. do you have kotlin installed?
{
    "code":"ENOENT",
    "errno":"ENOENT",
    "syscall":"spawn C:\\Users\\Aidan\\Desktop\\my-react-
app\\node_modules\\kotlin-compiler\\bin\\kotlinc-js",
    "path":"C:\\Users\\Aidan\\Desktop\\my-react-app\\node_modules\\kotlin-
compiler\\bin\\kotlinc-js",
    "spawnargs":
    [
        "-output",
        "C:\\Users\\Aidan\\Desktop\\my-react-
app\\node_modules\\.cache\\kotlin-webpack\\kotlinApp.js",
        "-source-map",
        "-nowarn",
        "-module-kind",
        "commonjs",
        "-libraries",
        "C:\\Users\\Aidan\\Desktop\\my-react-
app\\node_modules\\@jetbrains\\kotlin-
extensions\\build\\classes\\main\\kotlin-extensions.meta.js:C:\\Use
rs\\Aidan\\Desktop\\my-react-app\\node_modules\\@jetbrains\\kotlin-
react\\build\\classes\\main\\kotlin-
react.meta.js:C:\\Users\\Aidan\\Desktop\\my-react-
app\\node_modules\\@jetbrains\\kotlin-react-dom\\
build\\classes\\main\\kotlin-react-
dom.meta.js:C:\\Users\\Aidan\\Desktop\\my-react-
app\\node_modules\\@hypnosphi\\kotlinx-html-js\\target\\classes\\kotlinx-
html-js.meta.js",
        "C:\\Users\\Aidan\\Desktop\\my-react-app\\src"
    ]
}

I have tried installing the Kotlin compiler, npm installing kotlinc-js both globally and locally, and searching the node-modules to see if the files that the system is trying to access are present, and nothing is changing. Any help would be appreciated, and I apologize ahead of time if this is an easily fixed issue.

我已经尝试安装Kotlin编译器,npm在全局和本地安装kotlinc-js,并搜索节点模块以查看系统正在尝试访问的文件是否存在,并且没有任何变化。任何帮助将不胜感激,如果这是一个容易解决的问题,我提前道歉。

2 个解决方案

#1


0  

As leonya pointed out, it's a windows issue. For the time being you can use the Windows Subsystem for Linux to compile and run your app with bash, while still using your normal windows for the IDE and everything else.

正如leonya指出的那样,这是一个Windows问题。目前,您可以使用Windows子系统Linux来使用bash编译和运行您的应用程序,同时仍然使用IDE的常规窗口以及其他所有内容。

You can still use windows' cmd and npm to create the project with create-react-kotlin-app my-app, then start bash in the same folder (just type bash in cmd and hit enter) to run npm start

您仍然可以使用windows'cmd和npm使用create-react-kotlin-app my-app创建项目,然后在同一文件夹中启动bash(只需在cmd中键入bash并按Enter键)即可运行npm start

If you don't have WSL installed, follow the instructions in the link above to install Ubuntu on WSL. Then install npm and jdk8:

如果您没有安装WSL,请按照上面链接中的说明在WSL上安装Ubuntu。然后安装npm和jdk8:

sudo apt-get update
curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -
sudo apt-get install -y nodejs
sudo npm update -g npm
sudo apt-get install -y default-jdk

if you have npm in your windows PATH you may need to add the following alias to bash_aliases in your user's home directory:

如果您在Windows PATH中有npm,则可能需要在用户主目录中的bash_aliases中添加以下别名:

alias npm=/usr/bin/npm

Otherwise bash may try to use the windows npm which obviously won't work.

否则bash可能会尝试使用windows npm,这显然是行不通的。

#2


0  

Seems that Windows is currently unsupported as there's been several reports of this exact problem. Please watch https://youtrack.jetbrains.com/issue/CRKA-43.

似乎Windows目前不受支持,因为有几个关于这个确切问题的报告。请观看https://youtrack.jetbrains.com/issue/CRKA-43。

https://youtrack.jetbrains.com/issues/CRKA is our public issue tracker.

https://youtrack.jetbrains.com/issues/CRKA是我们的公共问题跟踪器。

[Updated on 04.11.2017] The issue is now fixed.

[更新于04.11.2017]此问题现已修复。

#1


0  

As leonya pointed out, it's a windows issue. For the time being you can use the Windows Subsystem for Linux to compile and run your app with bash, while still using your normal windows for the IDE and everything else.

正如leonya指出的那样,这是一个Windows问题。目前,您可以使用Windows子系统Linux来使用bash编译和运行您的应用程序,同时仍然使用IDE的常规窗口以及其他所有内容。

You can still use windows' cmd and npm to create the project with create-react-kotlin-app my-app, then start bash in the same folder (just type bash in cmd and hit enter) to run npm start

您仍然可以使用windows'cmd和npm使用create-react-kotlin-app my-app创建项目,然后在同一文件夹中启动bash(只需在cmd中键入bash并按Enter键)即可运行npm start

If you don't have WSL installed, follow the instructions in the link above to install Ubuntu on WSL. Then install npm and jdk8:

如果您没有安装WSL,请按照上面链接中的说明在WSL上安装Ubuntu。然后安装npm和jdk8:

sudo apt-get update
curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -
sudo apt-get install -y nodejs
sudo npm update -g npm
sudo apt-get install -y default-jdk

if you have npm in your windows PATH you may need to add the following alias to bash_aliases in your user's home directory:

如果您在Windows PATH中有npm,则可能需要在用户主目录中的bash_aliases中添加以下别名:

alias npm=/usr/bin/npm

Otherwise bash may try to use the windows npm which obviously won't work.

否则bash可能会尝试使用windows npm,这显然是行不通的。

#2


0  

Seems that Windows is currently unsupported as there's been several reports of this exact problem. Please watch https://youtrack.jetbrains.com/issue/CRKA-43.

似乎Windows目前不受支持,因为有几个关于这个确切问题的报告。请观看https://youtrack.jetbrains.com/issue/CRKA-43。

https://youtrack.jetbrains.com/issues/CRKA is our public issue tracker.

https://youtrack.jetbrains.com/issues/CRKA是我们的公共问题跟踪器。

[Updated on 04.11.2017] The issue is now fixed.

[更新于04.11.2017]此问题现已修复。