0

I have tried to use lodash for datatable. Here is what I have tried:

  • npm install lodash - gave cannot find package error

  • searched issue and then tried npm install --save @types/lodash

this produced following output:

+-- UNMET DEPENDENCY @angular/common@~2.1.0
+-- UNMET PEER DEPENDENCY @angular/[email protected] invalid
+-- UNMET DEPENDENCY @angular/core@~2.1.0
`-- @types/[email protected]

which I dont understand, since my package.json has following:

"@angular/common": "~2.1.0",
"@angular/compiler": "~2.1.0",
"@angular/core": "~2.1.0",
  • after this, IDE can find package, but when I run npm start/ng serve I get multiple errors

    ERROR in [default] path\node_modules\@types\lodash\index.d.ts:192 81:20 Cannot find namespace '_'.

    ERROR in [default] path\node_modules\@types\lodash\index.d.ts:190 21:57 Cannot find name 'Many'.

    ERROR in [default] path\node_modules\@types\lodash\index.d.ts:194 41:0 Declaration or statement expected.

and first two errors repeat multiple times each, but with different number (i guess line)

What should i do, to solve this issue?

2 Answers 2

0

This problem occurs when you are installing a old module(as written in your package.json) but it is not available on git due to update in their version. for solving this issue

    1.Need to install the project’s local dependencies (that’s where it’s looking for lodash). To do that,
    2.cd into the project directory and run npm install.
    3.You can also try npm i --save lodash

If the package.json file exists, and if it contains the lodash dependency you could try to remove the node_modules folder and run following command:

$ npm cache clean    
$ npm install

The first command will clean the npm cache. (just to be sure) The second command will install all (missing) dependencies of the project.

Sign up to request clarification or add additional context in comments.

Comments

0

So what worked for me, was to get package.json file from another (working project) and run npm install. I still have no idea why mine didn't work, but that is what solved the issue.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.