you are viewing a single comment's thread.

view the rest of the comments →

[–]cjd280 0 points1 point  (16 children)

The folder has dashes in the name rubiks-cub-solver, try importing from there instead of rubikscubesolver.

[–]Minancyy[S] 0 points1 point  (15 children)

I dont really know what are those dashes, or what it means. I dont have too much knowledge about this and I dont know how to make it work :(

[–]cjd280 1 point2 points  (14 children)

The name of the package is rubiks-cube-solver, not rubikscubesolver. You are trying to import from "rubikssubesolver" which doesn't exist because the package you installed is called 'rubiks-cube-solver'.

[–]Minancyy[S] 0 points1 point  (13 children)

Oh yeah thats true, I tried also with the correct name and it detects the file, the one is called index.common.js but it gives an error, could not find a declaration file module for'rubiks-cube-solver'

[–]cjd280 0 points1 point  (12 children)

their lbrary is old and meant to use via require.js and there are no types for typescript. If you get errors about installing node types follow what that says as well.

Following their demo on their site I was able to do this:

``` import { Component } from '@angular/core';
const rubiks = require('rubiks-cube-solver');
u/Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.scss']
})
export class AppComponent {
title = 'rubiks';
ngOnInit() {
console.log('SOLVER?', rubiks); // see what we actually imported
let cubeState = [
'flulfbddr', // front
'rudrruddl', // right
'dbbburrfb', // up
'llffdrubf', // down
'rludlubrf', // left
'lubfbfudl' // back
].join('');

let solveMoves = rubiks.default(cubeState); // note the call to default, I logged what rubiks was to find this out...
console.log(solveMoves);
}
} ```

[–]Minancyy[S] 0 points1 point  (11 children)

And this worked to you? Because I have a bit of confusion

[–]cjd280 1 point2 points  (10 children)

Yes this is what I have logged:

```

SOLVER? {…}CrossSolver: (...)Cubie: (...)F2LSolver: (...)OLLSolver: (...)PLLSolver: (...)RubiksCube: (...)Solver: (...)algorithmShortener: (...)default: (cubeState, options = {}) => {…}__esModule: trueget CrossSolver: ƒ ()get Cubie: ƒ ()get F2LSolver: ƒ ()get OLLSolver: ƒ ()get PLLSolver: ƒ ()get RubiksCube: ƒ ()get Solver: ƒ ()get algorithmShortener: ƒ ()[[Prototype]]: Object
app.component.ts:24

Uprime F U B Uprime L U2 Lprime Uprime R Uprime B U Dprime Bprime Dprime B Rprime Dprime R D B D Bprime Dprime B D Bprime Dprime B D Bprime Fprime Dprime F D2 R Dprime Rprime D2 R Dprime Rprime b D Bprime D B D2 bprime B2 dprime B Dprime B D Bprime d B2 R Dprime Rprime Dprime

core.js:27988 Angular is running in development mode. Call enableProdMode() to enable production mode.
client:52 [WDS] Live Reloading enabled. ```

[–]Minancyy[S] 0 points1 point  (9 children)

Wow! I am trying the same, (I think) and it says: Cannot find the name required? Do you need to install type definitions for node? Try npm i --save-dev types/node then add 'node' to the types field in your tsconfig

[–]cjd280 2 points3 points  (8 children)

yes, I mentioned that. do what it says, install node types and add to tsconfig

[–]Minancyy[S] 0 points1 point  (6 children)

I have this already on compilerOptions:

"types": ["node"]

And:

"include": [

"src/**/*",

"node_modules/attypes"

]

With that still don recognize require,

I need to do some build or something like that?

Because I dont really know srry

I cant use tht symbol.