我们目前正在开发一个小型应用程序,它只渲染外部 React 组件(因为它是外部npm install组件)。此应用程序的目的是获取一些 JSON 配置并将其作为 prop 传递给该组件以演示其用法。
该应用程序是由 create-react-app 创建的,它对脚手架应用程序的唯一更改是 index.tsx 和 App.tsx 文件的内容。嗯,公共目录中还添加了两个 JSON 文件。
现在的问题是,这个项目可以在我同事的机器上编译并运行,但不能在我的机器上运行。之后npm ci我npm start得到以下信息:
Failed to compile.
Module not found: Error: You attempted to import /home/newlukai/story/app/node_modules/react-refresh/runtime.js which falls outside of the project src/ directory. Relative imports outside of src/ are not supported.
You can either move it inside src/, or add a symlink to it from project's node_modules/.
assets by path static/js/*.js 4.81 MiB
asset static/js/bundle.js 4.8 …Run Code Online (Sandbox Code Playgroud)