简体   繁体   English

nodejs searchkit演示“找不到模块'react'。”

[英]nodejs searchkit demos “Cannot find module 'react'.”

I'm trying to install a searchkit demo "IMDB Search Demo": http://searchkit.co/demos 我正在尝试安装Searchkit演示“ IMDB Search演示”: http ://searchkit.co/demos

I copied the contents of: https://github.com/searchkit/searchkit-demo to a folder on my Desktop 我将以下内容复制到了我的桌面上: https : //github.com/searchkit/searchkit-demo

I installed nodejs, went into that folder in cmd, typed "npm install" and "npm start" 我安装了nodejs,进入cmd中的该文件夹,键入“ npm install”和“ npm start”

There is a ridiculously large list of errors that say for example: 这里有大量错误,例如:

ERROR in ./src/index.tsx
(2,24): error TS2307: Cannot find module 'react'.

and at the end: 最后:

webpack: Failed to compile

I then used "npm i -S react" to install react myself. 然后,我使用“ npm i -S react”来安装自己。

npm start: same error messages. npm start:相同的错误消息。

At localhost:3000 there opens a webpage that says "Sample App" in the header, but the page is blank white. 在localhost:3000,打开一个网页,该网页的标题中显示“ Sample App”,但该页面为空白。

Do you have any Idea why this does not work? 您有任何想法为什么这行不通吗? I tried it on ubuntu: same result, so i guess I'm missing something important. 我在ubuntu上尝试过:结果相同,所以我想我缺少了一些重要的东西。

Thanks. 谢谢。

You may have forgotten to install tsd package manager and run tsd install as stated in searchkit-demo project : 您可能忘记了按照tskit-demo项目中的说明安装tsd软件包管理器并运行tsd install

npm install tsd -g

Then install with tsd and npm (react is installed with tsd ) : 然后使用tsdnpm进行安装(用tsd安装):

tsd install
npm install

Then with npm start : 然后使用npm start

webpack built e4e4b2ce528a415bed3e in 5340ms
Version: webpack 1.14.0
Time: 5340ms
    Asset     Size  Chunks             Chunk Names
bundle.js  2.79 MB       0  [emitted]  main
webpack: Compiled successfully.

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM