Tyson Boyce
Tyson Boyce

Reputation: 29

Error: Can't Resolve 'node_modules/marked/lib/marked.js'

I'm trying to compile my Angular app using

ng serve

The error I receive is



Error: Can't resolve 'node_modules/marked/lib/marked.js' in 'C:\ProjectName'

The error doesn't tell me what file it is coming from, and only points to the entire project folder.

I can't find any reference in my code to marked.js, it's not in my package.json either, i've searched all files and even tried installing/uninstalling marked.js

I can't find any stacks on this. Is there a way to find out where the source of this error is from?

Upvotes: 2

Views: 2238

Answers (1)

Stefano Borzì
Stefano Borzì

Reputation: 2476

Depending on your marked package version you can have the script marked.js with different names or paths.

In your angular.json file you are probably importing it using

"scripts": ["node_modules/marked/lib/marked.js"]

but depending on your version you could have:

"scripts": ["node_modules/marked/marked.min.js"]
// OR
"scripts": ["node_modules/marked/marked.esm.js"]

as pointed here.

I encountered the same issue using ngx-markdown package which depends on marked.js and using "^11.0.1" instead of "11.0.1", depending on your nodejs package versions you could download a different marked.js version that have a different path so I strongly recommend to use always fixed package.json like "11.0.1".

If you did not solve with the paths listed above, check in your node_modules/marked/ directory what is the correct path.

Upvotes: 0

Related Questions