我正在执行示例项目https://github.com/minimal-xyz/minimal-shadow-cljs-importing-npm,以便稍后添加光子依赖项https://silvia-odwyer.github.io/photon/guide/using-photon-web/,并在执行以下步骤后得到以下警告。
PS C:\Users\usuario\desktop\clojure\minimal-shadow-cljs-browser> yarn
shadow-cljs watch app
yarn run v1.22.10
$ C:\Users\usuario\desktop\clojure\minimal-shadow-cljs-browser\node_mo
dules\.bin\shadow-cljs watch app
shadow-cljs - config: C:\Users\usuario\desktop\clojure\minimal-shadow-
cljs-browser\shadow-cljs.edn
shadow-cljs - socket connect failed, server process dead?
shadow-cljs - HTTP server available at http://localhost:8080
shadow-cljs - server version: 2.11.5 running at http://localhost:9630
shadow-cljs - nREPL server started on port 49569
shadow-cljs - watching build :app
[:app] Configuring build.
[:app] Compiling ...
[:app] Build failure:
The required JS dependency "@silvia-odwyer/photon" is not available, i
t was required by "app/main.cljs".
Dependency Trace:
app/main.cljs
Searched for npm packages in:
C:\Users\usuario\desktop\clojure\minimal-shadow-cljs-browser\n
ode_modules
See: https://shadow-cljs.github.io/docs/UsersGuide.html#npm-install在执行'npx阴影-cljs监视客户端‘或’纱线阴影-cljs监视客户端‘之前,我尝试过:
npm install --save @silvia-odwyer/photon
npm install @silvia-odwyer/photon
yarn add @silvia-odwyer/photon而且这些文件确实在node_modules文件夹中,但不起作用
我试过'npm缓存干净的-f‘并重新安装
我尝试删除node_modules文件夹和Packy-lock.jason文件,然后重新安装。
https://github.com/minimal-xyz/minimal-shadow-cljs-browser也有同样的问题
示例项目可以很好地处理所包含的依赖项(在安装Photon依赖项之前)
以下是安装后的package.json:
{
"scripts": {
"html": "mkdir -p target/; cp entry/index.html target/"
},
"dependencies": {
"@silvia-odwyer/photon": "^0.2.0",
"dayjs": "^1.7.7",
"lodash": "^4.17.19",
"shortid": "^2.2.13"
},
"devDependencies": {
"shadow-cljs": "^2.6.23"
},
"name": "minimal-shadow-cljs-importing-npm",
"description": "",
"version": "0.1.0",
"main": "index.js",
"author": "",
"license": "MIT"
}这是我的影子-cljs.edn:
{:source-paths ["src"]
:builds {:client {:output-dir "target/"
:asset-path "./"
:target :browser
:modules {:client {:init-fn app.main/main!}}
:devtools {:after-load app.main/reload!
:http-root "target"
:http-port 8080}}}
:jvm-opts ["-Xmx1024m"]}下面是与其他文件一样需要/导入依赖项的main.cljs文件:
(ns app.main
(:require ["dayjs" :as dayjs]
["shortid" :as shortid]
["lodash" :as lodash]
["lodash" :refer [isString]]
["@silvia-odwyer/photon" :as sop]))PS C:\Users\usuario\desktop\clojure\minimal-shadow-cljs-browser> node -v
v12.19.0
PS C:\Users\usuario\desktop\clojure\minimal-shadow-cljs-browser> npm -v
6.14.8我漏掉了什么?
发布于 2020-10-10 14:44:46
光子是一个高性能的图像处理库,用Rust编写,可编译成WebAssembly,既可以在本地使用,也可以在网络上使用。
目前,影子cljs不支持WebAssembly捆绑。
不知道为什么你收到一个错误,告诉你它不存在。所讨论的库包含一个已编译的.wasm文件,因此无论如何都不能正常工作。
https://stackoverflow.com/questions/64267882
复制相似问题