Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Core libs failing to compile? #124

Closed
vermiculus opened this issue Nov 23, 2017 · 8 comments
Closed

Core libs failing to compile? #124

vermiculus opened this issue Nov 23, 2017 · 8 comments

Comments

@vermiculus
Copy link

vermiculus commented Nov 23, 2017

Relatively new to JS/TS (and certainly new to the node ecosystem), so bear with me…

npm --install global typescript
npm --install global yarn
mkdir -p exercism/typescript && cd exercism/typescript
exercism fetch typescript
cd hello-world
yarn install
yarn test

gives me a good chunk of errors that would seem to have nothing to do with the exercise:

$ hello-world yarn test
yarn run v1.3.2
$ tsc --noEmit -p . && jest --no-cache
hello-world.test.ts(11,12): error TS2554: Expected 0 arguments, but got 1.
hello-world.test.ts(15,12): error TS2554: Expected 0 arguments, but got 1.
node_modules/typescript/lib/lib.es2015.collection.d.ts(45,11): error TS2428: All declarations of 'WeakMap' must have identical type parameters.
node_modules/typescript/lib/lib.es2015.core.d.ts(21,14): error TS2300: Duplicate identifier 'PropertyKey'.
node_modules/typescript/lib/lib.es2015.iterable.d.ts(157,11): error TS2428: All declarations of 'WeakMap' must have identical type parameters.
node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts(133,11): error TS2428: All declarations of 'WeakMap' must have identical type parameters.
../../../node_modules/@types/core-js/index.d.ts(21,14): error TS2300: Duplicate identifier 'PropertyKey'.
../../../node_modules/@types/core-js/index.d.ts(85,5): error TS2687: All declarations of 'name' must have identical modifiers.
../../../node_modules/@types/core-js/index.d.ts(145,5): error TS2403: Subsequent variable declarations must have the same type.  Variable '[Symbol.unscopables]' must be of type '{ copyWithin: boolean; entries: boolean; fill: boolean; find: boolean; findIndex: boolean; keys: ...', but here has type 'any'.
../../../node_modules/@types/core-js/index.d.ts(262,5): error TS2687: All declarations of 'flags' must have identical modifiers.
../../../node_modules/@types/core-js/index.d.ts(276,5): error TS2687: All declarations of 'EPSILON' must have identical modifiers.
../../../node_modules/@types/core-js/index.d.ts(311,5): error TS2687: All declarations of 'MAX_SAFE_INTEGER' must have identical modifiers.
../../../node_modules/@types/core-js/index.d.ts(318,5): error TS2687: All declarations of 'MIN_SAFE_INTEGER' must have identical modifiers.
../../../node_modules/@types/core-js/index.d.ts(457,5): error TS2403: Subsequent variable declarations must have the same type.  Variable '[Symbol.toStringTag]' must be of type '"Symbol"', but here has type 'string'.
../../../node_modules/@types/core-js/index.d.ts(457,5): error TS2687: All declarations of '[Symbol.toStringTag]' must have identical modifiers.
../../../node_modules/@types/core-js/index.d.ts(464,5): error TS2687: All declarations of 'prototype' must have identical modifiers.
../../../node_modules/@types/core-js/index.d.ts(492,5): error TS2687: All declarations of 'hasInstance' must have identical modifiers.
../../../node_modules/@types/core-js/index.d.ts(498,5): error TS2687: All declarations of 'isConcatSpreadable' must have identical modifiers.
../../../node_modules/@types/core-js/index.d.ts(504,5): error TS2687: All declarations of 'iterator' must have identical modifiers.
../../../node_modules/@types/core-js/index.d.ts(510,5): error TS2687: All declarations of 'match' must have identical modifiers.
../../../node_modules/@types/core-js/index.d.ts(516,5): error TS2687: All declarations of 'replace' must have identical modifiers.
../../../node_modules/@types/core-js/index.d.ts(522,5): error TS2687: All declarations of 'search' must have identical modifiers.
../../../node_modules/@types/core-js/index.d.ts(528,5): error TS2687: All declarations of 'species' must have identical modifiers.
../../../node_modules/@types/core-js/index.d.ts(534,5): error TS2687: All declarations of 'split' must have identical modifiers.
../../../node_modules/@types/core-js/index.d.ts(540,5): error TS2687: All declarations of 'toPrimitive' must have identical modifiers.
../../../node_modules/@types/core-js/index.d.ts(546,5): error TS2687: All declarations of 'toStringTag' must have identical modifiers.
../../../node_modules/@types/core-js/index.d.ts(552,5): error TS2687: All declarations of 'unscopables' must have identical modifiers.
../../../node_modules/@types/core-js/index.d.ts(609,5): error TS2403: Subsequent variable declarations must have the same type.  Variable '[Symbol.toStringTag]' must be of type '"Math"', but here has type 'string'.
../../../node_modules/@types/core-js/index.d.ts(609,5): error TS2687: All declarations of '[Symbol.toStringTag]' must have identical modifiers.
../../../node_modules/@types/core-js/index.d.ts(613,5): error TS2403: Subsequent variable declarations must have the same type.  Variable '[Symbol.toStringTag]' must be of type '"JSON"', but here has type 'string'.
../../../node_modules/@types/core-js/index.d.ts(613,5): error TS2687: All declarations of '[Symbol.toStringTag]' must have identical modifiers.
../../../node_modules/@types/core-js/index.d.ts(628,5): error TS2687: All declarations of 'size' must have identical modifiers.
../../../node_modules/@types/core-js/index.d.ts(634,5): error TS2687: All declarations of 'prototype' must have identical modifiers.
../../../node_modules/@types/core-js/index.d.ts(645,5): error TS2687: All declarations of 'size' must have identical modifiers.
../../../node_modules/@types/core-js/index.d.ts(651,5): error TS2687: All declarations of 'prototype' must have identical modifiers.
../../../node_modules/@types/core-js/index.d.ts(656,11): error TS2428: All declarations of 'WeakMap' must have identical type parameters.
../../../node_modules/@types/core-js/index.d.ts(664,27): error TS2344: Type 'K' does not satisfy the constraint 'object'.
../../../node_modules/@types/core-js/index.d.ts(665,53): error TS2344: Type 'K' does not satisfy the constraint 'object'.
../../../node_modules/@types/core-js/index.d.ts(666,5): error TS2403: Subsequent variable declarations must have the same type.  Variable 'prototype' must be of type 'WeakMap<object, any>', but here has type 'WeakMap<any, any>'.
../../../node_modules/@types/core-js/index.d.ts(666,5): error TS2687: All declarations of 'prototype' must have identical modifiers.
../../../node_modules/@types/core-js/index.d.ts(680,5): error TS2403: Subsequent variable declarations must have the same type.  Variable 'prototype' must be of type 'WeakSet<object>', but here has type 'WeakSet<any>'.
../../../node_modules/@types/core-js/index.d.ts(680,5): error TS2687: All declarations of 'prototype' must have identical modifiers.
../../../node_modules/@types/core-js/index.d.ts(692,5): error TS2403: Subsequent variable declarations must have the same type.  Variable 'value' must be of type 'T', but here has type 'T | undefined'.
../../../node_modules/@types/core-js/index.d.ts(692,5): error TS2687: All declarations of 'value' must have identical modifiers.
../../../node_modules/@types/core-js/index.d.ts(804,5): error TS2687: All declarations of 'prototype' must have identical modifiers.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

versions:

$ tsc -v
Version 2.6.1
$ yarn -v
1.3.2

As the core libs are failing to compile, I can never get the tests to actually pass (even though I can see there are no errors with my file). What's going on, here?

@masters3d
Copy link
Contributor

Do you get the same errors if you download this using the exercism client? exercism.io

@vermiculus
Copy link
Author

Is exercism fetch not the exercism client?

@masters3d
Copy link
Contributor

masters3d commented Nov 25, 2017

[mac hello-world]$ yarn test
yarn run v1.3.2
$ tsc --noEmit -p . && jest --no-cache
hello-world.test.ts(11,12): error TS2554: Expected 0 arguments, but got 1.
hello-world.test.ts(15,12): error TS2554: Expected 0 arguments, but got 1.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
[mac hello-world]$ tsc -v
Version 2.6.1
[mac hello-world]$ 

@masters3d masters3d reopened this Nov 25, 2017
@masters3d
Copy link
Contributor

masters3d commented Nov 25, 2017

I am not seeing the same errors. What happens if add the solution to the file?

class HelloWorld {
  static hello(name = 'World') {
        return `Hello, ${name}!`
    }
}

export default HelloWorld

@vermiculus
Copy link
Author

As I'd expect, I just get the core lib errors:

$ yarn test
yarn run v1.3.2
$ tsc --noEmit -p . && jest --no-cache
node_modules/typescript/lib/lib.es2015.collection.d.ts(45,11): error TS2428: All declarations of 'WeakMap' must have identical type parameters.
node_modules/typescript/lib/lib.es2015.core.d.ts(21,14): error TS2300: Duplicate identifier 'PropertyKey'.
node_modules/typescript/lib/lib.es2015.iterable.d.ts(157,11): error TS2428: All declarations of 'WeakMap' must have identical type parameters.
node_modules/typescript/lib/lib.es2015.symbol.wellknown.d.ts(133,11): error TS2428: All declarations of 'WeakMap' must have identical type parameters.
../../../node_modules/@types/core-js/index.d.ts(21,14): error TS2300: Duplicate identifier 'PropertyKey'.
../../../node_modules/@types/core-js/index.d.ts(85,5): error TS2687: All declarations of 'name' must have identical modifiers.
../../../node_modules/@types/core-js/index.d.ts(145,5): error TS2403: Subsequent variable declarations must have the same type.  Variable '[Symbol.unscopables]' must be of type '{ copyWithin: boolean; entries: boolean; fill: boolean; find: boolean; findIndex: boolean; keys: ...', but here has type 'any'.
../../../node_modules/@types/core-js/index.d.ts(262,5): error TS2687: All declarations of 'flags' must have identical modifiers.
../../../node_modules/@types/core-js/index.d.ts(276,5): error TS2687: All declarations of 'EPSILON' must have identical modifiers.
../../../node_modules/@types/core-js/index.d.ts(311,5): error TS2687: All declarations of 'MAX_SAFE_INTEGER' must have identical modifiers.
../../../node_modules/@types/core-js/index.d.ts(318,5): error TS2687: All declarations of 'MIN_SAFE_INTEGER' must have identical modifiers.
../../../node_modules/@types/core-js/index.d.ts(457,5): error TS2403: Subsequent variable declarations must have the same type.  Variable '[Symbol.toStringTag]' must be of type '"Symbol"', but here has type 'string'.
../../../node_modules/@types/core-js/index.d.ts(457,5): error TS2687: All declarations of '[Symbol.toStringTag]' must have identical modifiers.
../../../node_modules/@types/core-js/index.d.ts(464,5): error TS2687: All declarations of 'prototype' must have identical modifiers.
../../../node_modules/@types/core-js/index.d.ts(492,5): error TS2687: All declarations of 'hasInstance' must have identical modifiers.
../../../node_modules/@types/core-js/index.d.ts(498,5): error TS2687: All declarations of 'isConcatSpreadable' must have identical modifiers.
../../../node_modules/@types/core-js/index.d.ts(504,5): error TS2687: All declarations of 'iterator' must have identical modifiers.
../../../node_modules/@types/core-js/index.d.ts(510,5): error TS2687: All declarations of 'match' must have identical modifiers.
../../../node_modules/@types/core-js/index.d.ts(516,5): error TS2687: All declarations of 'replace' must have identical modifiers.
../../../node_modules/@types/core-js/index.d.ts(522,5): error TS2687: All declarations of 'search' must have identical modifiers.
../../../node_modules/@types/core-js/index.d.ts(528,5): error TS2687: All declarations of 'species' must have identical modifiers.
../../../node_modules/@types/core-js/index.d.ts(534,5): error TS2687: All declarations of 'split' must have identical modifiers.
../../../node_modules/@types/core-js/index.d.ts(540,5): error TS2687: All declarations of 'toPrimitive' must have identical modifiers.
../../../node_modules/@types/core-js/index.d.ts(546,5): error TS2687: All declarations of 'toStringTag' must have identical modifiers.
../../../node_modules/@types/core-js/index.d.ts(552,5): error TS2687: All declarations of 'unscopables' must have identical modifiers.
../../../node_modules/@types/core-js/index.d.ts(609,5): error TS2403: Subsequent variable declarations must have the same type.  Variable '[Symbol.toStringTag]' must be of type '"Math"', but here has type 'string'.
../../../node_modules/@types/core-js/index.d.ts(609,5): error TS2687: All declarations of '[Symbol.toStringTag]' must have identical modifiers.
../../../node_modules/@types/core-js/index.d.ts(613,5): error TS2403: Subsequent variable declarations must have the same type.  Variable '[Symbol.toStringTag]' must be of type '"JSON"', but here has type 'string'.
../../../node_modules/@types/core-js/index.d.ts(613,5): error TS2687: All declarations of '[Symbol.toStringTag]' must have identical modifiers.
../../../node_modules/@types/core-js/index.d.ts(628,5): error TS2687: All declarations of 'size' must have identical modifiers.
../../../node_modules/@types/core-js/index.d.ts(634,5): error TS2687: All declarations of 'prototype' must have identical modifiers.
../../../node_modules/@types/core-js/index.d.ts(645,5): error TS2687: All declarations of 'size' must have identical modifiers.
../../../node_modules/@types/core-js/index.d.ts(651,5): error TS2687: All declarations of 'prototype' must have identical modifiers.
../../../node_modules/@types/core-js/index.d.ts(656,11): error TS2428: All declarations of 'WeakMap' must have identical type parameters.
../../../node_modules/@types/core-js/index.d.ts(664,27): error TS2344: Type 'K' does not satisfy the constraint 'object'.
../../../node_modules/@types/core-js/index.d.ts(665,53): error TS2344: Type 'K' does not satisfy the constraint 'object'.
../../../node_modules/@types/core-js/index.d.ts(666,5): error TS2403: Subsequent variable declarations must have the same type.  Variable 'prototype' must be of type 'WeakMap<object, any>', but here has type 'WeakMap<any, any>'.
../../../node_modules/@types/core-js/index.d.ts(666,5): error TS2687: All declarations of 'prototype' must have identical modifiers.
../../../node_modules/@types/core-js/index.d.ts(680,5): error TS2403: Subsequent variable declarations must have the same type.  Variable 'prototype' must be of type 'WeakSet<object>', but here has type 'WeakSet<any>'.
../../../node_modules/@types/core-js/index.d.ts(680,5): error TS2687: All declarations of 'prototype' must have identical modifiers.
../../../node_modules/@types/core-js/index.d.ts(692,5): error TS2403: Subsequent variable declarations must have the same type.  Variable 'value' must be of type 'T', but here has type 'T | undefined'.
../../../node_modules/@types/core-js/index.d.ts(692,5): error TS2687: All declarations of 'value' must have identical modifiers.
../../../node_modules/@types/core-js/index.d.ts(804,5): error TS2687: All declarations of 'prototype' must have identical modifiers.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

@masters3d
Copy link
Contributor

Are you using visual studio?

I’m out of ideas.
microsoft/TypeScript#7369

Maybe try reinstalling TypeScript?

@vermiculus
Copy link
Author

I'm on OSX (and using emacs, but that shouldn't matter).

Alright, it took some finagling, but a full bore uninstall/reinstall worked. Here's my transcript in case anyone else runs into this issue.

 6339  npm help                 # Not kidding; I know nothing about node
 6340  npm help | grep uninstall
 6341  npm uninstall typescript
 6342  ..
 6343  ls
 6344  rm -rf hello-world/      # removing old trials of `exercism fetch typescript`
 6345  rm -rf hello-world2
 6346  npm uninstall yarn       # trying to uninstall
 6347  npm uninstall -g yarn    # must be global
 6348  npm uninstall -g typescript
 6349  yarn                     # verifying uninstall
 6350  tsc
 6351  brew install typescript yarn # trying the install again with brew (was installed with npm the first time)
 6352  exercism fetch typescript    # retrying the compile
 6353  ls
 6354  cd hello-world
 6355  yarn test                # forgot things needed to install first
 6356  yarn install
 6357  yarn test                # but the test failed anyway
 6358  rm -rf node_modules      # so I put on my angry eyes and just started deleting stuff
 6359  ls ../../../node_modules
 6360  rm -rf ../../../node_modules
 6361  brew unsintall typescript # can't even type straight
 6362  brew uninstall typescript
 6363  brew erase typescript    # just to be sure, but this isn't a valid command
 6364  brew uninstall yarn
 6365  cd /usr/local/Cellar     # just making sure it's all gone
 6366  ls
 6367  ls -la | grep yarn
 6368  ls -la | grep typ
 6369  brew install typescript  # reinstall with brew
 6370  brew install yarn
 6371  cd ~/exercism
 6372  exercism fetch typescript
 6373  cd scheme                # whoops; tab completion fail
 6374  cd ..
 6375  cd typescript/hello-world
 6376  yarn install             # install
 6377  yarn test                # test
 6378  histor                   # so ecstatic that it worked, I forget how to type again
 6379  history

and my lovely new test log:

yarn run v1.3.2
$ tsc --noEmit -p . && jest --no-cache
hello-world.test.ts(11,12): error TS2554: Expected 0 arguments, but got 1.
hello-world.test.ts(15,12): error TS2554: Expected 0 arguments, but got 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

@vermiculus
Copy link
Author

Thanks for your help!

In summary, a full bore uninstall/reinstall was the solution to this problem. I suspect ~/node_modules/ became somehow corrupted (or out-of-date?) and that removing it (after uninstalling typescript/yarn) was essential to the fix. So,

rm -rf ~/exercism/typescript # your exercism directory
npm uninstall -g typescript && npm uninstall -g yarn # if originally installed via npm
brew uninstall typescript yarn # if originally installed via homebrew
rm -rf ~/node_modules/ # remove node modules
brew install typescript yarn
exercism fetch typescript
cd ~/exercism/typescript/hello_world/ # or wherever exercism places the directory
yarn install && yarn test

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants