I am seeing an error when I start to run my node application.
Error says "ERROR in Metadata version mismatch for module ../node_modules/#ng-bootstrap/ng-bootstrap/index.d.ts, found version 4, expected 3"
Full error trace is:
ERROR in Metadata version mismatch for module
D:/MyProj/Client/node_modules/#ng-bootstrap/ng-bootstrap/index.d.ts,
found version 4, expected 3, resolving symbol AppModule in
D:/MyProj/Client/src/app/app.module.ts, resolving symbol AppModule in
D:/MyProj/Client/src/app/app.module.ts, resolving symbol AppModule in
D:/MyProj/Client/src/app/app.module.ts webpack: Failed to compile.
I got the same error
Probably in your package.json you have the following:
"#ng-bootstrap/ng-bootstrap": "^<VERSION_HERE>"
The problem is with the dependecies versions, so you can just update everthing to the last version, there is a topic in stackoverflow already: Metadata version mismatch with Angular 4
Or in my case that I couldn't just update all packages,I did the following:
I removed the package, also removed the ^ signal before the version number and then ran npm i again.
After this the app worked properly.
Related
Still somewhat of a beginner in Node, so apologies for what might be a newbie question. I have a small Chrome extension that I built where the only imported node module is one called node-fetch. I've never had trouble running yarn build to build a package that includes all the requisite dependencies. However, when I try to build my current package, yarn throws this error in the console:
π¨ /Users/me/Documents/GitHub/my-project/node_modules/node-fetch/src/index.js:9:17: Cannot resolve dependency 'node:http'
7 | */
8 |
> 9 | import http from 'node:http';
| ^
10 | import https from 'node:https';
11 | import zlib from 'node:zlib';
12 | import Stream, {PassThrough, pipeline as pump} from 'node:stream';
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
ERROR: "build:bg" exited with 1.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
So, this error is coming from the node_modules file myself rather than the code I wrote. Inside the package.json, I only declare this one dependency:
"dependencies": {
"node-fetch": "^3.3.0"
}
I tried manually installing the referenced packages and referencing them in the dependencies but to no avail.
What am I missing?
Tried to yarn build a package with a dependency on the node-fetch module that I import into my code. yarn throwing an error on the node-fetch module itself when I attempt to build.
Reverting to ^2.6.1 resolves the problem. Still interested to learn a better solve.
I am trying to run
npm install --legacy-peer-deps
but got some error.
here is the error:
Error: Error on worker #1: Error: Debug Failure. Unhandled SyntaxKind: Unknown.
at pipelineEmitWithHintWorker (portal/node_modules/typescript/lib/typescript.js:113076:22)
Also I added a log on this line
typescript.js:113076:22
console.log(node, node.kind)
ts.Debug.fail("Unhandled SyntaxKind: ".concat(ts.Debug.formatSyntaxKind(node.kind), "."));
the output is
t undefined
I think it might be a node version issue, but not sure what is happening, if anyone can help, I am very appreciated.
Let me know if anymore infomation need to be provided.
I had this issue today too. I found that targeting Typescript < 4.8 was the key to resolving this issue.
In your package.json change your typescript version (dev dependency) to something akin to this:
"typescript": "<4.8"
or specifically set the version eg
"typescript": "4.6.4"
You should check the node_modules folder to ensure that you did not install the 4.8.2 package which I think has this incompatability.
Details: running OS 10.11, using Angular version 1.2.6, npm 5.3.0, node 8.2.0.
So I'm learning Angular for the first time, and I keep running into the same problem where if I create a new project using 'ng new [PROJECT]' and then use 'ng serve' it compiles and displays properly, but then if I try to use 'ng g c [NEW_COMPONENT]' then it breaks the project. Specifically, it says that 'Module Not Found: Error: Can't resolve [PATH]' and it gives a valid path for the component, the path that ng itself generated. What's going on here? I've tried uninstalling #angular/cli and node and npm several times and I can't seem to get Angular to reliably generate new components on its own. What am I doing wrong here?
ERROR in /Users/{USER}/Dropbox/angularprojects/shadowrun-inventory/src/app/app.module.ts (5,36): Cannot find module './src/app/inventory/inventory.component'.
ERROR in Error encountered resolving symbol values statically. Could not resolve ./src/app/inventory/inventory.component relative to /Users/{USER}/Dropbox/angularprojects/shadowrun-inventory/src/app/app.module.ts., resolving symbol AppModule in /Users/{USER}/Dropbox/angularprojects/shadowrun-inventory/src/app/app.module.ts, resolving symbol AppModule in /Users/{USER}/Dropbox/angularprojects/shadowrun-inventory/src/app/app.module.ts
ERROR in ./src/app/app.module.ts
Module not found: Error: Can't resolve './src/app/inventory/inventory.component' in '/Users/{USER}/Dropbox/angularprojects/shadowrun-inventory/src/app'
# ./src/app/app.module.ts 10:0-77
# ./src/main.ts
# multi webpack-dev-server/client?http://localhost:4200 ./src/main.ts
webpack: Failed to compile.
This is the error I receive. What am I doing wrong here?
ionic 2.1.13
typings 2.0.0
npm 4.0.2
cordova 6.4.0
update
I added
"types": [
"firebase"
]
to the tsconfig.json file suggested from the AngularFire site. This "fixed" the current problem, Ionic Serve no longer throws the error below but the page still fails to load. The output from the console reads, 404 for both '/build/main.css' and '/build/main.js'
I'm building an Ionic 2 app with Firebase, the app has ran successful so far but now I'm getting this error,
screen capture of error message
I've looked in this file:
typescript: node_modules/#ionic/app-scripts/dist/util/events.d.ts, line: 1
and `/// gives the error "cannot find type definition file for 'node'
any ideas of what may be going on?
I've had other issues with this too: Failed at the ionic-hello-world# watch script 'ionic-app-scripts watch'. #256`
I'm creating a new React project and I have a dependency issue between react-router and history :
ERROR in ./~/react-router/lib/match.js
Module not found: Error: Cannot resolve module 'history/lib/Actions' in /app/node_modules/react-router/lib
# ./~/react-router/lib/match.js 15:15-45
ERROR in ./~/react-router/lib/useRouterHistory.js
Module not found: Error: Cannot resolve module 'history/lib/useQueries' in /app/node_modules/react-router/lib
# ./~/react-router/lib/useRouterHistory.js 6:18-51
ERROR in ./~/react-router/lib/createMemoryHistory.js
Module not found: Error: Cannot resolve module 'history/lib/useQueries' in /app/node_modules/react-router/lib
# ./~/react-router/lib/createMemoryHistory.js 6:18-51
ERROR in ./~/react-router/lib/useRouterHistory.js
Module not found: Error: Cannot resolve module 'history/lib/useBasename' in /app/node_modules/react-router/lib
# ./~/react-router/lib/useRouterHistory.js 10:19-53
ERROR in ./~/react-router/lib/createMemoryHistory.js
Module not found: Error: Cannot resolve module 'history/lib/useBasename' in /app/node_modules/react-router/lib
# ./~/react-router/lib/createMemoryHistory.js 10:19-53
ERROR in ./~/react-router/lib/browserHistory.js
Module not found: Error: Cannot resolve module 'history/lib/createBrowserHistory' in /app/node_modules/react-router/lib
# ./~/react-router/lib/browserHistory.js 5:28-71
ERROR in ./~/react-router/lib/hashHistory.js
Module not found: Error: Cannot resolve module 'history/lib/createHashHistory' in /app/node_modules/react-router/lib
# ./~/react-router/lib/hashHistory.js 5:25-65
ERROR in ./~/react-router/lib/createMemoryHistory.js
Module not found: Error: Cannot resolve module 'history/lib/createMemoryHistory' in /app/node_modules/react-router/lib
# ./~/react-router/lib/createMemoryHistory.js 14:27-69
I'm using react-router last release 3.0.0 which has history 3.0.0 as a dependency in its package.json.
I'm using npm version 3.10.8 and even if history module is installed by react-router dependency, I added it in my package.json too, as stated in react-router docs.
Thing is react-router is searching its requires in history/lib/ while history module has its files in history/ (no lib folder).
Since it doesn't depend on my configuration/installation but on third parties modules, I don't see what to do and I'm surprised to not find any issue regarding this.
The problem is actually to follow react-router installation instructions, adding history module in our own package.json.
Installing the last version of history on your own instead of the one required by react-router is creating this conflict.
With react-router >= 3.0, history is a dependency with a fixed version requirement, installed along with react-router itself :
βββ¬ react-router#3.0.0
βββ history#3.2.1
no need to install it manually in your package.json, it will create conflicts if you don't specify the right required version.
Thanks to #ShubhamKhatri for having pointing me in this direction.
If you are using npm version greater than 3.0.0 .
Note that you need to also install the history package since it is a peer dependency of React Router and won't automatically be installed for you in npm version freater than 3.0.0.
Run npm install history and you should be good.
The path needs to be updated it is no longer
history/lib/createHashHistory
It's just
history/createHashHistory
React Training Link
Also probably import HashRouter from react-route-dom. HashRouter replaces Router and no need to pass history as a prop anymore.