Cannot find module typescript.js after Windows restoration point. I’m triying to build my angular app

Published

I had problems with my PC and I restored windows to and old restoration point.

After this… When I try to build my Angular App I have the next error:

C:UdemyAngularDeCeroAExpertoEdicion2021-paisesApp>npm run build

> [email protected] build C:UdemyAngularDeCeroAExpertoEdicion2021-paisesApp
> npm run config -- --environment=prod && ng build --prod


> [email protected] config C:UdemyAngularDeCeroAExpertoEdicion2021-paisesApp
> ts-node ./src/assets/scripts/setEnv.ts "--environment=prod"

internal/modules/cjs/loader.js:329
      throw err;
      ^

Error: Cannot find module 'C:UdemyAngularDeCeroAExpertoEdicion2021-paisesAppnode_modulestypescriptlibtypescript.js'. Please verify that the package.json has a valid "main" entry
    at tryPackage (internal/modules/cjs/loader.js:321:19)
    at Function.Module._findPath (internal/modules/cjs/loader.js:534:18)
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:888:27)
    at Function.resolve (internal/modules/cjs/helpers.js:98:19)
    at loadCompiler (C:UsersmyuserAppDataRoamingnpmnode_modulests-nodedistindex.js:208:34)
    at create (C:UsersmyuserAppDataRoamingnpmnode_modulests-nodedistindex.js:213:28)
    at Object.register (C:UsersmyuserAppDataRoamingnpmnode_modulests-nodedistindex.js:184:21)
    at main (C:UsersmyuserAppDataRoamingnpmnode_modulests-nodedistbin.js:129:29)
    at Object.<anonymous> (C:UsersmyuserAppDataRoamingnpmnode_modulests-nodedistbin.js:448:5)
    at Module._compile (internal/modules/cjs/loader.js:1085:14) {
  code: 'MODULE_NOT_FOUND',
  path: 'C:UdemyAngularDeCeroAExpertoEdicion20213-paisesAppnode_modulestypescriptpackage.json',
  requestPath: 'typescript'
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] config: `ts-node ./src/assets/scripts/setEnv.ts "--environment=prod"`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] config script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:UsersmyuserAppDataRoamingnpm-cache_logs21-08-01T08_27_09_159Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] build: `npm run config -- --environment=prod && ng build --prod`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:UsersmyuserAppDataRoamingnpm-cache_logs21-08-01T08_27_09_186Z-debug.log

I think that the problem is with the directory:

C:UsersmyuserAppDataRoamingnpmnode_modules

What can I do?
remove the folder node_modules?
reinstall npm?

I tried with npm install and all is ok.

Thanks.

Source: Angular Questions

Published
Categorized as angular, node.js, npm, typescript Tagged , , ,

Answers

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Still Have Questions?


Our dedicated development team is here for you!

We can help you find answers to your question for as low as 5$.

Contact Us
faq