Error with SassError: Undefined function while starting angular app - node.js

I am getting error while starting angular app after successful npm install.
It shows below error -
ERROR in ./src/styles.scss (./node_modules/css-loader/dist/cjs.js??ref--13-1!./node_modules/postcss-loader/src??embedded!./node_modules/sass-loader/dist/cjs.js
??ref--13-3!./src/styles.scss)
Module build failed (from ./node_modules/sass-loader/dist/cjs.js):
SassError: Undefined function.
╷
19 │ $marker-size-third: ceil(math.div($marker-size, 3));
│ ^^^^^^^^^^^^^^^^^^^^^^^^^
╵
node_modules\progress-tracker\src\styles\progress-tracker_progress-tracker-variables.scss 19:26 #import
node_modules\progress-tracker\src\styles\progress-tracker.scss 1:9
Current package-lock.json has sass and sass-loader version -
"sass": "1.26.3",
"sass-loader": "8.0.2",

The version of sass that you are using do not support the mathematical function div. You are using the version 1.26.3 and that function appeared in the version 1.33.0 as you can see in their documentation.
So in order to fix your issue, you have essentially 2 possibilities.
Bump the sass version if you can (the preferable way).
Use the old (and deprecated, so be aware) / operator.
If you use the option number 2, your code would become this:
$marker-size-third: ceil( $marker-size / 3 );

Related

Laravel webpack compile error bootstrap variable undefined

I'm struggling for hours but don't know why I'm getting this on webpack compile command node version 12
ERROR in ./node_modules/css-loader??ref--8-2!./node_modules/postcss-loader/lib??postcss!./node_modules/resolve-url-loader??ref--8-4!./node_modules/sass-loader/lib/loader.js??ref--8-5!./resources/assets/sass/main.scss
Module build failed:
font-weight: $font-weight-bolder; // Add the correct font weight in Chrome, Edge, and Safari
^
Undefined variable: "$font-weight-bolder".
in /www/wwwroot/ship-hero.codersarray.com/node_modules/bootstrap/scss/_reboot.scss (line 158, column 16)
# ./resources/assets/sass/main.scss 4:14-267
# multi ./resources/assets/js/pages/install.js ./resources/assets/sass/main.scss
ERROR in ./resources/assets/sass/main.scss
Module build failed: ModuleBuildError: Module build failed:
font-weight: $font-weight-bolder; // Add the correct font weight in Chrome, Edge, and Safari
^
Undefined variable: "$font-weight-bolder".
in /www/wwwroot/ship-hero.codersarray.com/node_modules/bootstrap/scss/_reboot.scss (line 158, column 16)
at /www/wwwroot/ship-hero.codersarray.com/node_modules/webpack/lib/NormalModule.js:195:19
at /www/wwwroot/ship-hero.codersarray.com/node_modules/loader-runner/lib/LoaderRunner.js:367:11
at /www/wwwroot/ship-hero.codersarray.com/node_modules/loader-runner/lib/LoaderRunner.js:233:18
at context.callback (/www/wwwroot/ship-hero.codersarray.com/node_modules/loader-runner/lib/LoaderRunner.js:111:13)
at Object.callback (/www/wwwroot/ship-hero.codersarray.com/node_modules/sass-loader/lib/loader.js:55:13)
at Object.done [as callback] (/www/wwwroot/ship-hero.codersarray.com/node_modules/neo-async/async.js:8069:18)
at options.error (/www/wwwroot/ship-hero.codersarray.com/node_modules/node-sass/lib/index.js:294:32)
# ./resources/assets/sass/main.scss
# multi ./resources/assets/js/pages/install.js ./resources/assets/sass/main.scss
I already fixed it here is the solution if anyone encounters the same problem the issue is with the bootstrap version according to package.json bootstrap version is ^4.0.0 but on running npm install 4.6 version is being installed that is causing the issue so I just install the specific version that is 4.0.0 changed the value in the package.json from ^4.0.0 to 4.0.0.

Cargo Publish uses different dependency version

When I do cargo publish of my library it fails to compile the project because for a some reason it uses different version of a dependency. But if I do cargo build it works fine.
I see that for cargo publish it uses two different version of one of the dependencies:
Compiling bitcoin v0.27.1
Compiling bitcoin v0.28.1
And it fails later because one of the dependencies uses 0.27.1 and another 0.28.1.
The dependency is specified as bitcoin = "=0.27.1" in Cargo.toml. If I look into Cargo.lock file I see only version 0.27.1. I.e. only one entry, no other versions in Cargo.lock. cargo tree shows only version 0.27.1 as well. And cargo build uses only 0.27.1 for compilation.
It's absolutely unclear where from the 0.28.1 comes from during the cargo publish
How I can tell cargo publish to not use 0.28.1 and stick to version in the Cargo.lock? I tried --locked and --frozen but I doesn't make any effect.
UPDATE
One of the dependencies has defined bitcoin = ">= 0.27" and it seems that Cargo tries to use the most up-to-date version 0.28.1 only because it fits that criteria for that lib. And 0.27.1 for others. That obviously would not work. How to enforce it to use one version?
UPDATE 2:
There is the whole tree of the conflicting versions cargo tree --all-features:
├── bitcoin v0.27.1
.
├── emerald-hwkey v0.2.0
│ ├── bitcoin v0.27.1 (*)
│ ├── hdpath v0.6.1
│ │ ├── bitcoin v0.28.1
Where hdpath:0.6.1's Crate.toml accepts any version via:
bitcoin = { version = ">= 0.27", optional = true }
So it's unclear why Cargo tries to upgrade this particular version and makes everything incompatible to each other.
UPDATE 3:
It seems that it works if I use a local version of hdpath with enforced ">= 0.27, < 0.28". But I don't want that because hdpath by itself doesn't have a reason for such restriction and works fine with any of the versions.
So I just need to make sure it uses the version compatible with the parent project. Is there any way?

Solana/Anchor error: (yanked dependencies) Failed to obtain package metadata: `cargo metadata` exited with an error: Updating crates.io index

I just set up a new anchor project yesterday, every command runs smoothly.
Today I installed a new anchor project. I run anchor test to see if the project is set up correctly. I am getting this error:
Failed to obtain package metadata: `cargo metadata` exited with an error: Updating crates.io index
error: failed to select a version for the requirement `anchor-lang = "^0.23.0"`
candidate versions found which didn't match: 0.24.2
location searched: crates.io index
required by package `myAnchorProject v0.1.0 (.../programs/myAnchorProject)`
It is not clear what candidate versions mean. I deleted node_modules and install it with "#project-serum/anchor": "^0.24.2", still same error.
I clear the lib.rs and testing file to see something different, but it still gives the same error.
executing cargo update is giving same error
It's not the problem with dependency in your package.json is due to the use of yanked rust crate anchor-lang
all the other version the 0.24.2 have been yanked so you can't build any cargo project which has yanked dependeny.
refer here https://crates.io/crates/anchor-lang/versions
what you need to do get it working is
go to <your-project-root>/programs/myAnchorProject/cargo.toml.
I'm assuming your program name is myAnchorProject or replace it with your program name.
your current cargo.toml must look something like
...
<other content goes here>
...
[dependencies]
anchor-lang = "^0.23.0"
you need to upgrade the anchor-lang version to 0.24.2 or any other version if available which is not yanked.
so your final cargo.toml should look like
...
<other content goes here>
...
[dependencies]
anchor-lang = "^0.24.2"

app:compileDebugJavaWithJavac task failing, erroring out on its own code

I'm getting this error after running npx react-native run-android, and I'm new to react and node in general so I'm not sure what could be going on.
gradle build --warning-mode all runs successfully with no issue. Not sure what could be going on. Running react-native upgrade doesn't help as suggested in similar questions, but it does give the error "Accessing non-existent property 'padLevels' of module exports inside circular dependency", though I think it's unrelated.
I'm on npm 6.14.10, node v14.15.4, Gradle 6.4, react-native-cli 2.0.1, react-native 0.63.4, openjdk 14.0.2
> Task :app:compileDebugJavaWithJavac FAILED
Deprecated Gradle features were used in this build, making it incompatible with Gradle 7.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/6.4/userguide/command_line_interface.html#sec:command_line_warnings
106 actionable tasks: 2 executed, 104 up-to-date
/android/app/src/main/java/com/test/MainApplication.java:20: error: cannot find symbol
return BuildConfig.DEBUG;
^
symbol: variable BuildConfig
/android/app/src/main/java/com/test/MainApplication.java:59: error: cannot find symbol
if (BuildConfig.DEBUG) {
^
symbol: variable BuildConfig
location: class MainApplication
/android/app/src/main/java/com/test/MainApplication.java:59: error: illegal parenthesized expression
if (BuildConfig.DEBUG) {
^
Note: /android/app/src/debug/java/com/test/ReactNativeFlipper.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.

`ng build --prod` fails with `ERROR in TypeError: Cannot read property 'version' of null`

I can't successfully get my project to build with the --prod flag [it builds fine otherwise]. I can temporarly add maxMetadata && to the if statement where the error occurs to null check and get passed that point (metadata_reader.js line 66) and then I get a list of "real" issues related to a production distribution; but I'd like to get some insight as to why it is happening in the first place and see if there is a permanent fix. I have managed to find similar issues around and have tried much of what other people have tried, but it doesn't seem to be exactly the same issue and have yet to find a resolution.
Versions:
Angular CLI: 1.6.5
Node: 8.9.4
OS: win32 x64
Angular: 5.2.3
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router
#angular/cli: 1.6.5
#angular-devkit/build-optimizer: 0.0.42
#angular-devkit/core: 0.0.29
#angular-devkit/schematics: 0.0.52
#ngtools/json-schema: 1.1.0
#ngtools/webpack: 1.9.5
#schematics/angular: 0.1.17
typescript: 2.7.1
webpack: 3.10.0
Full stack trace:
ERROR in TypeError: Cannot read property 'version' of null
at readMetadataFile (C:\git\screenings-plus\node_modules\#angular\compiler-cli\src\transformers\metadata_reader.js:66:29)
at Object.readMetadata (C:\git\screenings-plus\node_modules\#angular\compiler-cli\src\transformers\metadata_reader.js:35:25)
at TsCompilerAotCompilerTypeCheckHostAdapter.getMetadataFor (C:\git\screenings-plus\node_modules\#angular\compiler-cli\src\transformers\compiler_host.js:425:34)
at StaticSymbolResolver.getModuleMetadata (C:\git\screenings-plus\node_modules\#angular\compiler\bundles\compiler.umd.js:29726:62)
at StaticSymbolResolver.hasDecorators (C:\git\screenings-plus\node_modules\#angular\compiler\bundles\compiler.umd.js:29426:46)
at analyzeFile (C:\git\screenings-plus\node_modules\#angular\compiler\bundles\compiler.umd.js:31299:63)
at AotCompiler._analyzeFile (C:\git\screenings-plus\node_modules\#angular\compiler\bundles\compiler.umd.js:30509:17)
at AotCompiler.findGeneratedFileNames (C:\git\screenings-plus\node_modules\#angular\compiler\bundles\compiler.umd.js:30525:42)
at Object.findGeneratedFileNames (C:\git\screenings-plus\node_modules\#angular\compiler-cli\src\transformers\program.js:397:82)
at TsCompilerAotCompilerTypeCheckHostAdapter.getSourceFile (C:\git\screenings-plus\node_modules\#angular\compiler-cli\src\transformers\compiler_host.js:337:55)
at findSourceFile (C:\git\screenings-plus\node_modules\typescript\lib\typescript.js:74915:29)
at args (C:\git\screenings-plus\node_modules\typescript\lib\typescript.js:74852:85)
at getSourceFileFromReferenceWorker (C:\git\screenings-plus\node_modules\typescript\lib\typescript.js:74825:34)
at processSourceFile (C:\git\screenings-plus\node_modules\typescript\lib\typescript.js:74852:13)
at processRootFile (C:\git\screenings-plus\node_modules\typescript\lib\typescript.js:74706:13)
at C:\git\screenings-plus\node_modules\typescript\lib\typescript.js:73855:60
To solve the issue, I placed a console.log(maxMetadata.version); on line 66 of the metadata_reader.js and was able to get a lead to where the problem was, which turned out to be a metadata file [*.metadata.json] within my project. It had [null] which needs to be [] for all current versions of Angular. Once this was changed, I was able to get a normal ng build --prod build readout.

Resources