Closed ZenVoich closed 1 year ago
This looks like a Windows-specific regression. I'll do my best to repro and fix this for you.
This should now be fixed in 0.9.2. Let me know otherwise and I'll take another look.
Same error.
Output:
Loading packages for directory: e:\ic\mops
Running `mops sources` in directory: e:\ic\mops
Loading packages for directory: e:\ic\mops\backend
Running `npx --no ic-mops sources` in directory: e:\ic\mops\backend
Received: ["--package","base",".mops\\base@0.8.1\\src","--package","time-consts",".mops\\time-consts@1.0.0\\src","--package","_","backend","--package","test","..\\packages\\test\\src",""]
Package: base -> /e:/ic/mops/.mops/base@0.8.1/src (file:///e%3A/ic/mops)
Package: time-consts -> /e:/ic/mops/.mops/time-consts@1.0.0/src (file:///e%3A/ic/mops)
Package: _ -> /e:/ic/mops/backend (file:///e%3A/ic/mops)
Package: test -> /e:/ic/packages/test/src (file:///e%3A/ic/mops)
Received: [""]
Checking workspace
~ /e:/ic/mops/backend/main/download-log.mo (file:///e%3A/ic/mops/backend)
A few debugging questions:
dfx.json
file in ...\mops
, and then directly from a mops.toml
file in ...\mops\backend
. Is this correct and intended?backend
, test
, or everywhere?As a short-term fix / debugging step, you could try adding the following dfx.json
file to ...\mops\backend
:
{
"defaults": {
"build": {
"packtool": "mops sources"
}
}
}
The extension will use the specified packtool command instead of the npx ic-mops
command (which runs for autodetected mops.toml
files). Hopefully this will make it slightly easier to debug the issue.
It looks like the extension is reading from a dfx.json file in ...\mops, and then directly from a mops.toml file in ...\mops\backend. Is this correct and intended?
yes, backend/mops.toml
contents:
[package]
baseDir = "."
it just changes default value of baseDir="src"
to resolve path to backend
not to backend/src
.
For packages publishing to mops checked that baseDir="src"
Where in the project do these errors occur, e.g. in backend, test, or everywhere?
Everywhere, in each import line importing package (except base
)
As a short-term fix / debugging step, you could try adding the following dfx.json file to ...\mops\backend:
there is no dfx.json
in backend dir
Just found out that removing backend/mops.toml
solves the problem.
it just changes default value of baseDir="src" to resolve path to backend not to backend/src
It was intended to use root dir as "local package" to use it as mo:_/file.mo
instead of ../../file.mo
Probably doesn't make much sense, I'll just delete it)
Okay, good to know about the baseDir
field. I'm glad this worked as a solution!
This happens to me in macOS as well, trying to import any package with the extensions results in the "package not defined" error.
Project builds fine, but in vscode I see erros like this:
LS output:
windows 10 vscode-motoko 0.9.1