Cannot start npm - node.js

I installed the seed app here: https://github.com/moizKachwala/Angular2-expressjs-mongoose-gulp-node-typescript
I'm trying to run npm start but the server is not being created and started.
I thought maybe this line "(node:16596) fs: re-evaluating native module sources is not supported. If you are using the graceful-fs module, please update it to a more recent version" was the issue and I found that on SO its was suggested to make sure you have latest npm which I do.
NOTE: The gulp script is supposed to create the dist folder where it will place all the js files but the dist folder is not being created so the gulp script is failing somewhere...
What else could it be?
c:\work\angular\pricecompare1>npm start
> angular2-express#1.0.0 start c:\work\angular\pricecompare1
> concurrent --kill-others "gulp watch" "gulp start"
[1] [09:35:54]
[0] [09:35:54] Requiring external module ts-node/register
[1] Requiring external module ts-node/register
[0] (node:16596) fs: re-evaluating native module sources is not supported. If you are using the graceful-fs module, please update it to a more recent version.
[1] (node:17124) fs: re-evaluating native module sources is not supported. If you are using the graceful-fs module, please update it to a more recent version.
[0] [09:35:55]
[0] Using gulpfile c:\work\angular\pricecompare1\gulpfile.ts
[1] [09:35:55] Using gulpfile c:\work\angular\pricecompare1\gulpfile.ts
[0] [09:35:55]
[0] Starting 'watch'...
[1] [09:35:55]
[1] Starting 'start'...
[1] [09:35:55]
[1] Finished 'start' after 1.88 ms
[1] [09:35:55] [nodemon] 1.10.0
[1] [09:35:55] [nodemon] to restart at any time, enter `rs`
[1] [09:35:55] [nodemon] watching: *.*
[1] [09:35:55] [nodemon] starting `node dist/server/server.js`
[0] [09:35:55] Finished 'watch' after 32 ms
[1] module.js:442
[1] throw err;
[1] ^
[1]
[1] Error: Cannot find module 'c:\work\angular\pricecompare1\dist\server\server.js'
[1] at Function.Module._resolveFilename (module.js:440:15)
[1] at Function.Module._load (module.js:388:25)
[1] at Module.runMain (module.js:575:10)
[1] at run (bootstrap_node.js:352:7)
[1] at startup (bootstrap_node.js:144:9)
[1] at bootstrap_node.js:467:3
[1] [09:35:55] [nodemon] app crashed - waiting for file changes before starting...

in your package.json file find start command and reference your server.js with correct directory
pricecompare1\dist\server\server.js

Related

Error: error:0308010C:digital envelope routines::unsupported

When I run my project everytime it shows the same error Anyone explain How i get rid of this error.
`PS C:\vervebot\trinethra_icms> npm run dev
> inventory-management#1.0.0 dev
> concurrently "npm run server" "npm run client"
[1]
[1] > inventory-management#1.0.0 client
[1] > npm start --prefix client
[1]
[0]
[0] > inventory-management#1.0.0 server
[0] > nodemon index.js
[0]
[0] [nodemon] 2.0.20
[0] [nodemon] to restart at any time, enter `rs`
[0] [nodemon] watching path(s): *.*
[0] [nodemon] watching extensions: js,mjs,json
[0] [nodemon] starting `node index.js`
[1]
[1] > client#0.1.0 start
[1] > react-scripts start
[1]
[0] Server running on PORT 5001
[1] [HPM] Proxy created: / -> http://localhost:5001
[1] [HPM] Proxy created: / -> https://dataservices.sypramsoftware.com/api
[1] i 「wds」: Project is running at http://192.168.1.11/
[1] i 「wds」: webpack output is served from
[1] i 「wds」: Content not from webpack is served from C:\vervebot\trinethra_icms\client\public
[1] i 「wds」: 404s will fallback to /
[1] Starting the development server...
[1]
[1] Error: error:0308010C:digital envelope routines::unsupported
[1] at new Hash (node:internal/crypto/hash:71:19)
[1] at Object.createHash (node:crypto:133:10)
[1] at module.exports (C:\vervebot\trinethra_icms\client\node_modules\webpack\lib\util\createHash.js:135:53)
[1] at NormalModule._initBuildHash (C:\vervebot\trinethra_icms\client\node_modules\webpack\lib\NormalModule.js:417:16)
[1] at handleParseError (C:\vervebot\trinethra_icms\client\node_modules\webpack\lib\NormalModule.js:471:10)
[1] at C:\vervebot\trinethra_icms\client\node_modules\webpack\lib\NormalModule.js:503:5
[1] at C:\vervebot\trinethra_icms\client\node_modules\webpack\lib\NormalModule.js:358:12
[1] at C:\vervebot\trinethra_icms\client\node_modules\loader-runner\lib\LoaderRunner.js:373:3
[1] at iterateNormalLoaders (C:\vervebot\trinethra_icms\client\node_modules\loader-runner\lib\LoaderRunner.js:214:10)
[1] at iterateNormalLoaders (C:\vervebot\trinethra_icms\client\node_modules\loader-runner\lib\LoaderRunner.js:221:10)
[1] C:\vervebot\trinethra_icms\client\node_modules\react-scripts\scripts\start.js:19
[1] throw err;
[1] ^
[1]
[1] Error: error:0308010C:digital envelope routines::unsupported
[1] at new Hash (node:internal/crypto/hash:71:19)
[1] at Object.createHash (node:crypto:133:10)
[1] at module.exports (C:\vervebot\trinethra_icms\client\node_modules\webpack\lib\util\createHash.js:135:53)
[1] at NormalModule._initBuildHash (C:\vervebot\trinethra_icms\client\node_modules\webpack\lib\NormalModule.js:417:16)
[1] at C:\vervebot\trinethra_icms\client\node_modules\webpack\lib\NormalModule.js:452:10
[1] at C:\vervebot\trinethra_icms\client\node_modules\webpack\lib\NormalModule.js:323:13
[1] at C:\vervebot\trinethra_icms\client\node_modules\loader-runner\lib\LoaderRunner.js:367:11
[1] at C:\vervebot\trinethra_icms\client\node_modules\loader-runner\lib\LoaderRunner.js:233:18
[1] at context.callback (C:\vervebot\trinethra_icms\client\node_modules\loader-runner\lib\LoaderRunner.js:111:13)
[1] at C:\vervebot\trinethra_icms\client\node_modules\babel-loader\lib\index.js:59:103 {
[1] opensslErrorStack: [ 'error:03000086:digital envelope routines::initialization error' ],
[1] library: 'digital envelope routines',
[1] reason: 'unsupported',
[1] code: 'ERR_OSSL_EVP_UNSUPPORTED'
[1] }
[1]
[1] Node.js v18.12.1
[1] npm run client exited with code 1`
This is the Screenshot, It will help to get an clear idea.
I also use npm audit fix --force but i have to delete npm module and reinstall again. After doing all this i recive the same error again.
I suspect you have node.js 17 installed on your machine. This error occurs because node.js 17 uses OpenSSL3, which has changed the code for the initialization context of md family (including md4), and this is a breaking change.
you can solve this issue in several ways,
change your 'start' script in package.json in to
"start": "react-scripts --openssl-legacy-provider start"
or you can downgrade your node version, you can use nvm to quickly install and use different versions of node via the command line.

React App failed to compile after install

After running the install script, the server starts and serves a page displaying the same text after the 'Failed to compile line.'
I'm running Windows 10 and auto update just updated my pc today, right before I did the create-react-express install.
PS H:\mern-passport> npm start
> mern#1.0.0 start H:\mern-passport
> if-env NODE_ENV=production && npm run start:prod || npm run start:dev
> mern#1.0.0 start:dev H:\mern-passport
> concurrently "nodemon --ignore 'client/*'" "npm run client"
[0] [nodemon] 1.19.4
[0] [nodemon] to restart at any time, enter `rs`
[0] [nodemon] watching dir(s): *.*
[0] [nodemon] watching extensions: js,mjs,json
[0] [nodemon] starting `node server.js`
[0] API server now on port 3001!
[1]
[1] > mern#1.0.0 client H:\mern-passport
[1] > cd client && npm run start
[1]
[1]
[1] > mern#0.1.0 start H:\mern-passport\client
[1] > react-scripts start
[1]
[1] Starting the development server...
[1]
[1] Failed to compile.
[1]
[1] ./src/index.css (./node_modules/css-loader??ref--6-oneOf-3-1!./node_modules/postcss-loader/src??postcss!./src/index.css)
[1] Error: Package exports for 'H:\mern-passport\client\node_modules\autoprefixer\node_modules\kleur' do not define a valid './colors' target
[0] Error: ENOENT: no such file or directory, stat 'H:\mern-passport\client\build\index.html'
[0] Error: ENOENT: no such file or directory, stat 'H:\mern-passport\client\build\index.html'
Seems to be an issue with autoprefixer latest version. I referred https://github.com/postcss/autoprefixer/issues/1328 and tried downgrading autoprefixer in my project and it works now.
Try:
npm install autoprefixer#9.8.0
Happy coding!
I also faced this problem. And it looks like a problem with autoprefixer version, so i changed the version.
npm install autoprefixer#9.8.0
I tried this, and it works perfectly.
I was running into this issue too. I installed yarn and created a new project with the npx create-react-app command and this fixed the issue.

node.js & react - server not up, from github project

I found one project on GitHub darkwire and wanted to install it and play with it. Firstly I tried to install it from windows. I installed Node.js and Yarn and I got errors with the command: yarn dev
`C:\darkwire.io-master>yarn dev
yarn run v1.21.1
$ concurrently 'cd client && yarn start' 'cd server && yarn dev'
[0] 'c' is not recognized as an internal or external command,
[0] operable program or batch file.
[1] 'client' is not recognized as an internal or external command,
[1] operable program or batch file.
[0] c exited with code 1
[1] client exited with code 1
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.`
My next step was to try it in ubuntu 19.10, firstly I installed again Node.js and Yarn and again used: yarn dev. I got an error but now was open site and it not working, just say "Disconnected"
```qq#ubuntu:~/Downloads/darkwire.io-master$ yarn dev
yarn run v1.21.1
$ concurrently 'cd client && yarn start' 'cd server && yarn dev'
$ nodemon src/index.js --exec babel-node
$ react-scripts start
[1] [nodemon] 1.19.0
[1] [nodemon] to restart at any time, enter `rs`
[1] [nodemon] watching: *.*
[1] [nodemon] starting `babel-node src/index.js`
[1] Browserslist: caniuse-lite is outdated. Please run next command `yarn upgrade`
[1] Checking for inactive rooms...
[1] Darkwire is online at port 3001
[1] events.js:183
[1] throw er; // Unhandled 'error' event
[1] ^
[1]
[1] Error: Redis connection to 127.0.0.1:6379 failed - connect ECONNREFUSED 127.0.0.1:6379
[1] at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1191:14)
[1] [nodemon] app crashed - waiting for file changes before starting...
[0] Starting the development server...
[0]
[0] Browserslist: caniuse-lite is outdated. Please run next command `yarn upgrade`
[0] Compiled successfully!
[0]
[0] You can now view darkwire-client in the browser.
[0]
[0] Local: http://localhost:3000/
[0] On Your Network: http://175.124.13.111:3000/
[0]
[0] Note that the development build is not optimized.
[0] To create a production build, use yarn build.
[0]
```
screenshot
I think maybe I have the wrong version Node.js and try install 9.x version, download again project and try again, it not help, try change port from 3001 to 3000, not help.
From their README.md
Darkwire Server
Darkwire server is a Node.js application that requires redis.
So please install a compatible redis server. Redis tutorial

MEAN starter kit showing error on installation

I wanted a mean starter kit so that I can build my app. Then I got this from github. I just made it setup then made npm install and then made npm start. But it showed me several errors like this
[nodemon] 1.12.1
[0] [nodemon] to restart at any time, enter `rs`
[0] [nodemon] watching: *.*
[0] [nodemon] starting `node server.js`
[0] ✓ App is running at http://localhost:3000 in development mode
[0] Press CTRL-C to stop
[0]
[1] Cannot read property 'config' of null
[1] TypeError: Cannot read property 'config' of null
[1] at Class.run (/Users/Sites/tryouts/mean/node_modules/#angular/cli/tasks/serve.js:51:63)
[1] at check_port_1.checkPort.then.port (/Users/Sites/tryouts/mean/node_modules/#angular/cli/commands/serve.js:123:26)
[1] at <anonymous>
[1] at process._tickCallback (internal/process/next_tick.js:188:7)
So can someone tell me how to make this working? Any help and suggestions will be really appreciable.

nodemon throwing unhandled error event

I am trying to run nodemon on my local pc.
Even if i just run the command without parameters i get the following error:
events.js:182
throw er; // Unhandled 'error' event
^
Error: spawn cmd ENOENT
at _errnoException (util.js:1019:11)
at Process.ChildProcess._handle.onexit (internal/child_process.js:192:19)
at onErrorNT (internal/child_process.js:374:16)
at _combinedTickCallback (internal/process/next_tick.js:138:11)
at process._tickCallback (internal/process/next_tick.js:180:9)
Turning on Verbose mode gives additional info along wiht this error:
[nodemon] Looking in package.json for nodemonConfig
[nodemon] 1.12.1
[nodemon] reading config C:\nodeprojects\myproject\package.json
[nodemon] to restart at any time, enter `rs`
[nodemon] ignoring: .git .nyc_output .sass-cache bower_components coverage C:\nodeprojects\myproject\node_modules/**/*
[nodemon] watching: *.*
[nodemon] watching extensions: js,json
[nodemon] starting `node app.js`
[nodemon] child pid: undefined
[nodemon] exiting
events.js:182
throw er; // Unhandled 'error' event
^
(Note - paths in above error altered to remove my username)
I have tried the basics, restarting my pc, checking if another app is using port 3000 (i dont think it is).
Any help or advice would be appreciated
Nodemon simply starts command "node app.js", if start node ok, it'll track files changes and restart node process.
Your error seems to cause by lack of nodejs configurations.
Try to check node program directory path is included in PATH variable or not.
In the windows pc, there're steps:
Find node install folder, commonly in C:\Program Files\nodejs or C:\Windows\System32\
Check this folder path in PATH variable value.

Resources