0
votes

I just started learning angular. I'm creating an empty Angular project. When I try to run the project I get an error like the following. This may be the cause.

ng new intro
ng serve --open

argument fn must be a function TypeError: argument fn must be a function at Function.wrapfunction [as function] (C:\kurs\angularProjects\intro\node_modules\depd\index.js:399:11) at populateConstructorExports (C:\kurs\angularProjects\intro\node_modules\http-errors\index.js:264:45) at Object. (C:\kurs\angularProjects\intro\node_modules\http-errors\index.js:30:1) at Module._compile (internal/modules/cjs/loader.js:776:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10) at Module.load (internal/modules/cjs/loader.js:643:32) at Function.Module._load (internal/modules/cjs/loader.js:556:12) at Module.require (internal/modules/cjs/loader.js:683:19) at require (internal/modules/cjs/helpers.js:16:16) at Object. (C:\kurs\angularProjects\intro\node_modules\send\index.js:15:19) at Module._compile (internal/modules/cjs/loader.js:776:30) at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10) at Module.load (internal/modules/cjs/loader.js:643:32) at Function.Module._load (internal/modules/cjs/loader.js:556:12) at Module.require (internal/modules/cjs/loader.js:683:19) at require (internal/modules/cjs/helpers.js:16:16)

3
you typed this whole line into a terminal at once? ng new intro will generate a new project once that is done, then you run it with ng serve --openrobert
I am generate a new project with "ng new intro". Then I try to run it with "ng serve --open".bturkmen

3 Answers

4
votes

Problem solved for me. This error occurred in the 12.6.0 Current version of node.js. I changed the version of node.js. I installed LTS version 10.16.0 and no error occurred

2
votes

This problem occurs in Turkish workstations with newer versions of node.js.

You should change the system language or downgrade your node.js version.

See: https://github.com/facebook/create-react-app/issues/7315

In my Windows 10 Home Premium Single Language license workstation, changing the language with an lp.cab file didn't solve problem.

I formatted and installed clean Windows Home Premium English.

Problem disappeared!

0
votes

Open the file node_modules\depd\index.js and change the function below.

function wrapfunction (fn, message) {
if (fn == undefined) return; // Add this line to solve the problem
if (typeof fn !== 'function') {
throw new TypeError('argument fn must be a function ' + fn)
}