Server (ng serve) cannot be started in angular 2 - node.js

I am new to angular 2. For last two days it was working good but when I came to start the angular 2 project locally by typing ng serve in command prompt it is not working. It throws the following error,
`
0 info it worked if it ends with ok
1 verbose cli [ 'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli 'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli 'start' ]
2 info using npm#3.10.8
3 info using node#v6.9.0
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle demo#0.0.0~prestart: demo#0.0.0
6 silly lifecycle demo#0.0.0~prestart: no script for prestart, continuing
7 info lifecycle demo#0.0.0~start: demo#0.0.0
8 verbose lifecycle demo#0.0.0~start: unsafe-perm in lifecycle true
9 verbose lifecycle demo#0.0.0~start: PATH: C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin;C:\Users\msuman\Desktop\work14th\node_modules\.bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\Google\Google Apps Sync\;C:\Program Files\Google\Google Apps Migration\;C:\Program Files (x86)\Brackets\command;C:\Program Files\nodejs\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\Google\Google Apps Sync\;C:\Program Files\Google\Google Apps Migration\;C:\Program Files (x86)\Brackets\command;C:\Program Files\nodejs\;C:\Users\msuman\AppData\Roaming\npm
10 verbose lifecycle demo#0.0.0~start: CWD: C:\Users\msuman\Desktop\work14th
11 silly lifecycle demo#0.0.0~start: Args: [ '/d /s /c', 'ng serve' ]
12 silly lifecycle demo#0.0.0~start: Returned: code: 1 signal: null
13 info lifecycle demo#0.0.0~start: Failed to exec start script
14 verbose stack Error: demo#0.0.0 start: `ng serve`
14 verbose stack Exit status 1
14 verbose stack at EventEmitter.<anonymous> (C:\Program Files\nodejs\node_modules\npm\lib\utils\lifecycle.js:255:16)
14 verbose stack at emitTwo (events.js:106:13)
14 verbose stack at EventEmitter.emit (events.js:191:7)
14 verbose stack at ChildProcess.<anonymous> (C:\Program Files\nodejs\node_modules\npm\lib\utils\spawn.js:40:14)
14 verbose stack at emitTwo (events.js:106:13)
14 verbose stack at ChildProcess.emit (events.js:191:7)
14 verbose stack at maybeClose (internal/child_process.js:877:16)
14 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
15 verbose pkgid demo#0.0.0
16 verbose cwd C:\Users\msuman\Desktop\work14th
17 error Windows_NT 6.1.7600
18 error argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "start"
19 error node v6.9.0
20 error npm v3.10.8
21 error code ELIFECYCLE
22 error demo#0.0.0 start: `ng serve`
22 error Exit status 1
23 error Failed at the demo#0.0.0 start script 'ng serve'.
23 error Make sure you have the latest version of node.js and npm installed.
23 error If you do, this is most likely a problem with the demo package,
23 error not with npm itself.
23 error Tell the author that this fails on your system:
23 error ng serve
23 error You can get information on how to open an issue for this project with:
23 error npm bugs demo
23 error Or if that isn't available, you can get their info via:
23 error npm owner ls demo
23 error There is likely additional logging output above.
24 verbose exit [ 1, true ]
`
Here is the screenshot of command prompt error,
I tried everything but can't make it done.
Will you please help me doing this?
Thanks in advance.
here is the content of angular-cli
`
{
"$schema": "./node_modules/#angular/cli/lib/config/schema.json",
"project": {
"name": "demo"
},
"apps": [
{
"root": "src",
"outDir": "dist",
"assets": [
"assets",
"favicon.ico"
],
"index": "index.html",
"main": "main.ts",
"polyfills": "polyfills.ts",
"test": "test.ts",
"tsconfig": "tsconfig.app.json",
"testTsconfig": "tsconfig.spec.json",
"prefix": "app",
"styles": [
"styles.css",
"../node_modules/ion-rangeslider/css/ion.rangeSlider.css",
"../node_modules/ion-rangeslider/css/ion.rangeSlider.skinFlat.css",
"../node_modules/bootstrap/dist/css/bootstrap.min.css",
"../node_modules/materialize-css/dist/css/materialize.min.css",
"../src/assets/js/bootstrap-slider/bootstrap-slider.min.css"
],
"scripts": [
"../node_modules/jquery/dist/jquery.min.js",
"../node_modules/ion-rangeslider/js/ion.rangeSlider.min.js",
"../src/assets/js/bootstrap-slider/bootstrap-slider.min.js",
"../src/assets/js/slider.js",
"../node_modules/materialize-css/dist/js/materialize.min.js",
],
"environmentSource": "environments/environment.ts",
"environments": {
"dev": "environments/environment.ts",
"prod": "environments/environment.prod.ts"
}
}
],
"e2e": {
"protractor": {
"config": "./protractor.conf.js"
}
},
"lint": [
{
"project": "src/tsconfig.app.json"
},
{
"project": "src/tsconfig.spec.json"
},
{
"project": "e2e/tsconfig.e2e.json"
}
],
"test": {
"karma": {
"config": "./karma.conf.js"
}
},
"defaults": {
"styleExt": "css",
"component": {}
}
}
`

The problem is withing the scripts key inside the JSON since JSON specification doesn't allow a trailing comma.
"scripts": [
"../node_modules/jquery/dist/jquery.min.js",
"../node_modules/ion-rangeslider/js/ion.rangeSlider.min.js",
"../src/assets/js/bootstrap-slider/bootstrap-slider.min.js",
"../src/assets/js/slider.js",
"../node_modules/materialize-css/dist/js/materialize.min.js",
]
Simply remove the blank line together with the comma at the end of the line just like in the snippet below.
"scripts": [
"../node_modules/jquery/dist/jquery.min.js",
"../node_modules/ion-rangeslider/js/ion.rangeSlider.min.js",
"../src/assets/js/bootstrap-slider/bootstrap-slider.min.js",
"../src/assets/js/slider.js",
"../node_modules/materialize-css/dist/js/materialize.min.js"
]

Related

next.js with-mongodb build error. error on `next build`?

I am trying to build a next.js project with-mongodb on it but its not working and im not sure why. The log doesn't appear to be very helpful with that the issue is (as far as i can tell) and so im not sure how to fix it. here is a copy of the log;
0 info it worked if it ends with ok
1 verbose cli [
1 verbose cli 'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli 'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli 'run',
1 verbose cli 'build'
1 verbose cli ]
2 info using npm#6.14.9
3 info using node#v14.15.3
4 verbose run-script [ 'prebuild', 'build', 'postbuild' ]
5 info lifecycle with-mongodb#0.1.0~prebuild: with-mongodb#0.1.0
6 info lifecycle with-mongodb#0.1.0~build: with-mongodb#0.1.0
7 verbose lifecycle with-mongodb#0.1.0~build: unsafe-perm in lifecycle true
8 verbose lifecycle with-mongodb#0.1.0~build: PATH: C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;E:\Creative\Programming\VS code\quote-db\node_modules\.bin;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Program Files\Oculus\Support\oculus-runtime;C:\Python39\Scripts\;C:\Python39\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files\PuTTY\;C:\ProgramData\chocolatey\bin;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\Calibre2\;C:\Program Files\nodejs\;C:\Program Files (x86)\Touch Portal\plugins\adb\platform-tools;C:\Program Files\Git\cmd;C:\Users\user_\AppData\Local\Microsoft\WindowsApps;C:\Users\user_\AppData\Local\Programs\Microsoft VS Code\bin;C:\Users\user_\AppData\Roaming\npm
9 verbose lifecycle with-mongodb#0.1.0~build: CWD: E:\Creative\Programming\VS code\quote-db
10 silly lifecycle with-mongodb#0.1.0~build: Args: [ '/d /s /c', 'next build' ]
11 silly lifecycle with-mongodb#0.1.0~build: Returned: code: 1 signal: null
12 info lifecycle with-mongodb#0.1.0~build: Failed to exec build script
13 verbose stack Error: with-mongodb#0.1.0 build: `next build`
13 verbose stack Exit status 1
13 verbose stack at EventEmitter.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\index.js:332:16)
13 verbose stack at EventEmitter.emit (events.js:315:20)
13 verbose stack at ChildProcess.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
13 verbose stack at ChildProcess.emit (events.js:315:20)
13 verbose stack at maybeClose (internal/child_process.js:1048:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:288:5)
14 verbose pkgid with-mongodb#0.1.0
15 verbose cwd E:\Creative\Programming\VS code\quote-db
16 verbose Windows_NT 10.0.18363
17 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "build"
18 verbose node v14.15.3
19 verbose npm v6.14.9
20 error code ELIFECYCLE
21 error errno 1
22 error with-mongodb#0.1.0 build: `next build`
22 error Exit status 1
23 error Failed at the with-mongodb#0.1.0 build script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]
EDIT: here is my package.json file.
{
"name": "with-mongodb",
"version": "0.1.0",
"scripts": {
"debug": "cross-env NODE_OPTIONS='--inspect' next dev",
"dev": "next dev",
"build": "next build",
"start": "next start"
},
"dependencies": {
"cross-env": "^7.0.3",
"mongodb": "^3.5.9",
"next": "latest",
"postcss-flexbugs-fixes": "^5.0.2",
"postcss-import": "^14.0.0",
"postcss-preset-env": "^6.7.0",
"precss": "^4.0.0",
"react": "^16.13.1",
"react-dom": "^16.13.1",
"sass": "^1.32.8",
"swr": "^0.4.2",
"tailwindcss": "^2.0.3"
},
"license": "MIT"
}
Today I tried again and recieved a proper error message.
ModuleNotFoundError: Module not found: Error: Can't resolve '../styles/main.module.scss' in 'E:\Creative\Programming\VS code\quote-db\pages'
I'm not sure what changed, but this is now solved. Presumably restarting my PC had something to do with it?

How to remove the start script error after executing 'npm start' for Reactjs App

I started making a project in Reactjs and i am watching a tutorial from Youtube. After creating my project using "npx create-react-app", when i try to execute "npm start" it shows a bunch of errors:
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! covid-19-tracker#0.1.0 start: `react-scripts start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the covid-19-tracker#0.1.0 start 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:\Users\VIVIDH\AppData\Roaming\npm-cache\_logs\2020-09-10T05_26_49_684Z-debug.log
npm -v = 6.14.8
node -v 14.4.0
I have tried most of the methods but it still isn't working. Here is my package.json file:
{
"name": "covid-19-tracker",
"version": "0.1.0",
"private": true,
"dependencies": {
"#testing-library/jest-dom": "^4.2.4",
"#testing-library/react": "^9.5.0",
"#testing-library/user-event": "^7.2.1",
"react": "^16.13.1",
"react-dom": "^16.13.1",
"react-scripts": "3.4.3"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": "react-app"
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
},
"description": "This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).",
"main": "index.js",
"devDependencies": {},
"repository": {
"type": "git",
"url": "git+https://github.com/Vividh25/covid-19-tracker.git"
},
"author": "Vividh Bhardwaj",
"license": "ISC",
"bugs": {
"url": "https://github.com/Vividh25/covid-19-tracker/issues"
},
"homepage": "https://github.com/Vividh25/covid-19-tracker#readme"
}
Debug.log:
0 info it worked if it ends with ok
1 verbose cli [
1 verbose cli 'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli 'C:\\Users\\VIVIDH\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli 'start'
1 verbose cli ]
2 info using npm#6.14.8
3 info using node#v14.4.0
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle covid-19-tracker#0.1.0~prestart: covid-19-tracker#0.1.0
6 info lifecycle covid-19-tracker#0.1.0~start: covid-19-tracker#0.1.0
7 verbose lifecycle covid-19-tracker#0.1.0~start: unsafe-perm in lifecycle true
8 verbose lifecycle covid-19-tracker#0.1.0~start: PATH: C:\Users\VIVIDH\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;C:\Users\VIVIDH\desktop\Projects\covid-19-tracker\node_modules\.bin;C:\Python38\Scripts\;C:\Python38\;C:\Windows\System32;D:\src\flutter\bin;C:\src\Git\cmd;C:\src\Git\cmd\git.exe;C:\Program Files\nodejs\;C:\ProgramData\chocolatey\bin;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\NVIDIA Corporation\NVIDIA NvDLISR;C:\Program Files\Git\cmd;C:\Windows\System32\ variable;"C:\Users\VIVIDH\AppData\Local\Microsoft\WindowsApps;C:\src\Git\cmd\git.exe;C:\src\Git\cmd";D:\Microsoft VS Code\bin;C:\Users\VIVIDH\AppData\Roaming\npm
9 verbose lifecycle covid-19-tracker#0.1.0~start: CWD: C:\Users\VIVIDH\desktop\Projects\covid-19-tracker
10 silly lifecycle covid-19-tracker#0.1.0~start: Args: [ '/d /s /c', 'react-scripts start' ]
11 silly lifecycle covid-19-tracker#0.1.0~start: Returned: code: 1 signal: null
12 info lifecycle covid-19-tracker#0.1.0~start: Failed to exec start script
13 verbose stack Error: covid-19-tracker#0.1.0 start: `react-scripts start`
13 verbose stack Exit status 1
13 verbose stack at EventEmitter.<anonymous> (C:\Users\VIVIDH\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\index.js:332:16)
13 verbose stack at EventEmitter.emit (events.js:315:20)
13 verbose stack at ChildProcess.<anonymous> (C:\Users\VIVIDH\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
13 verbose stack at ChildProcess.emit (events.js:315:20)
13 verbose stack at maybeClose (internal/child_process.js:1051:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:287:5)
14 verbose pkgid covid-19-tracker#0.1.0
15 verbose cwd C:\Users\VIVIDH\desktop\Projects\covid-19-tracker
16 verbose Windows_NT 10.0.18362
17 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\VIVIDH\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "start"
18 verbose node v14.4.0
19 verbose npm v6.14.8
20 error code ELIFECYCLE
21 error errno 1
22 error covid-19-tracker#0.1.0 start: `react-scripts start`
22 error Exit status 1
23 error Failed at the covid-19-tracker#0.1.0 start script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]
Please help me.
This is a problem of system variable path.
DO this.
Go to > Control Panel\System and Security\System\Advance system setting\Enviroment variable and set system variables path C:\Windows\System32\ variable and restart.
If you're facing the same problem and have tried everything and if it still isn't working then try running the project through yarn. You can install yarn from chocolatey which comes pre-installed when you download nodejs. Here's what you type on cmd :
choco install yarn
After installation:
yarn init
To start project:
yarn create react-app <your project name>
cd <your project name>
yarn start
This worked for me, and hope it does for you :)

Simple mocha test fails with command not recognized *.*

I am working through a tutorial/training on Puppeteer with jest and mocha-steps and am running into an issue at the very beginning with running a simple test to ensure the framework is functioning as expected.
Here is the test
describe('Config test', () => {
it('should work', () => {
console.log('done')
})
})
Here is my package.json file
{
"name": "pptr-mocha",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "./node_modules/mocha/bin/mocha --timeout=30000 ./build/tests/**.js",
"clean": "rm -rf build",
"build": "babel --preset es2015 -d build/ src/"
},
"author": "BBB",
"license": "ISC",
"dependencies": {
"chai": "^4.2.0",
"mocha": "^7.1.1",
"mocha-steps": "^1.3.0",
"puppeteer": "^2.1.1"
},
"devDependencies": {
"babel-cli": "^6.26.0",
"babel-preset-es2015": "^6.24.1"
}
}
When I run npm run build, the build folder structure is generated, as is my es5 version of the test. That all seems to work as described.
When I run npm run test, the test fails with the following error and I have been unable to figure out why.
0 info it worked if it ends with ok
1 verbose cli [
1 verbose cli 'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli 'C:\\Users\\bob\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli 'run',
1 verbose cli 'test'
1 verbose cli ]
2 info using npm#6.14.4
3 info using node#v12.16.0
4 verbose run-script [ 'pretest', 'test', 'posttest' ]
5 info lifecycle pptr-mocha#1.0.0~pretest: pptr-mocha#1.0.0
6 info lifecycle pptr-mocha#1.0.0~test: pptr-mocha#1.0.0
7 verbose lifecycle pptr-mocha#1.0.0~test: unsafe-perm in lifecycle true
8 verbose lifecycle pptr-mocha#1.0.0~test: PATH: C:\Users\bob\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;C:\automation\pptr\projects\pptr-mocha\node_modules\.bin;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;C:\Program Files\PuTTY\;C:\Program Files\TortoiseGit\bin;C:\Program Files\Git\cmd;C;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Dart\dart-sdk\bin;C:\Users\bob\AppData\Roaming\Pub\Cache\bin;C:\Program Files\nodejs\;C:\Program Files\dotnet\;C:\Program Files\Java\jdk1.8.0_201\bin;C:\devtools\apache-maven-3.6.3\bin;C:\Users\bob\AppData\Local\Microsoft\WindowsApps;C:\Users\bob\AppData\Local\atom\bin;C:\Users\bob\AppData\Local\Microsoft\WindowsApps;C;;C:\Users\bob\AppData\Local\Programs\Microsoft VS Code\bin;C:\Users\bob\AppData\Roaming\npm;C:\Users\bob\.dotnet\tools
9 verbose lifecycle pptr-mocha#1.0.0~test: CWD: C:\automation\pptr\projects\pptr-mocha
10 silly lifecycle pptr-mocha#1.0.0~test: Args: [
10 silly lifecycle '/d /s /c',
10 silly lifecycle './node_modules/mocha/bin/mocha --timeout=30000 ./build/tests/**.js'
10 silly lifecycle ]
11 silly lifecycle pptr-mocha#1.0.0~test: Returned: code: 1 signal: null
12 info lifecycle pptr-mocha#1.0.0~test: Failed to exec test script
13 verbose stack Error: pptr-mocha#1.0.0 test: `./node_modules/mocha/bin/mocha --timeout=30000 ./build/tests/**.js`
13 verbose stack Exit status 1
13 verbose stack at EventEmitter.<anonymous> (C:\Users\bob\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\index.js:332:16)
13 verbose stack at EventEmitter.emit (events.js:321:20)
13 verbose stack at ChildProcess.<anonymous> (C:\Users\bob\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
13 verbose stack at ChildProcess.emit (events.js:321:20)
13 verbose stack at maybeClose (internal/child_process.js:1021:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:286:5)
14 verbose pkgid pptr-mocha#1.0.0
15 verbose cwd C:\automation\pptr\projects\pptr-mocha
16 verbose Windows_NT 10.0.18362
17 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\bob\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "run" "test"
18 verbose node v12.16.0
19 verbose npm v6.14.4
20 error code ELIFECYCLE
21 error errno 1
22 error pptr-mocha#1.0.0 test: `./node_modules/mocha/bin/mocha --timeout=30000 ./build/tests/**.js`
22 error Exit status 1
23 error Failed at the pptr-mocha#1.0.0 test script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]
The tutorial is done on a Mac and I am in Windows, so I am not sure if that is the issue or not.
Also, running in vscode, if that matter.
Any assistance someone could offer up would be greatly appreciated.
The issue was with these two lines given that I am running in a Windows environment.
"test": "./node_modules/mocha/bin/mocha --timeout=30000 ./build/tests/**.js",
"clean": "rm -rf build",
Problem 1: In the "test": line, it couldn't find node as it must not be defined in my system path. So the line was changed to this.
"test": "node ./node_modules/mocha/bin/mocha --timeout=30000 ./build/tests/**.js",
In the clean line, the commands defined there assume mac/linux OS, so this line was changed to the following.
"clean": "rd /s /q build",
rd = remove directory
/s = get all files and sub-dirs
/q = do not prompt for confirmation

React.js create-react-app Npm Run Build - Failed

In my React create-react-app projects npm start is working fine, but the 'build' script fails almost immediately.
The error says failed to compile - 'EISDIR: illegal operation on a directory, read'
I've tried completely uninstalling and reinstalling node & npm using nvm.
I've tried creating a new create-react-app project without editing any of preloaded code, and build still fails.
terminal error message:
Creating an optimized production build...
Failed to compile.
EISDIR: illegal operation on a directory, read
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! personal-website#0.1.0 build: react-scripts build
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the personal-website#0.1.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
Debug log:
0 info it worked if it ends with ok
1 verbose cli [
1 verbose cli '/Users/Stew/.nvm/versions/node/v12.7.0/bin/node',
1 verbose cli '/Users/Stew/.nvm/versions/node/v12.7.0/bin/npm',
1 verbose cli 'run',
1 verbose cli 'build'
1 verbose cli ]
2 info using npm#6.10.2
3 info using node#v12.7.0
4 verbose run-script [ 'prebuild', 'build', 'postbuild' ]
5 info lifecycle personal-website#0.1.0~prebuild: personal-website#0.1.0
6 info lifecycle personal-website#0.1.0~build: personal-website#0.1.0
7 verbose lifecycle personal-website#0.1.0~build: unsafe-perm in lifecycle true
8 verbose lifecycle personal-website#0.1.0~build: PATH: /Users/Stew/.nvm/versions/node/v12.7.0/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/Users/Stew/Desktop/personal-website/node_modules/.bin:/Users/Stew/.nvm/versions/node/v12.7.0/bin:/usr/bin:/usr/sbin:/bin:/sbin
9 verbose lifecycle personal-website#0.1.0~build: CWD: /Users/Stew/Desktop/personal-website
10 silly lifecycle personal-website#0.1.0~build: Args: [ '-c', 'react-scripts build' ]
11 silly lifecycle personal-website#0.1.0~build: Returned: code: 1 signal: null
12 info lifecycle personal-website#0.1.0~build: Failed to exec build script
13 verbose stack Exit status 1
13 verbose stack at EventEmitter.<anonymous> (/Users/Stew/.nvm/versions/node/v12.7.0/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:326:16)
13 verbose stack at EventEmitter.emit (events.js:203:13)
13 verbose stack at ChildProcess.<anonymous> (/Users/Stew/.nvm/versions/node/v12.7.0/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack at ChildProcess.emit (events.js:203:13)
13 verbose stack at maybeClose (internal/child_process.js:1021:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:283:5)
14 verbose pkgid personal-website#0.1.0
15 verbose cwd /Users/Stew/Desktop/personal-website
16 verbose Darwin 18.6.0
17 verbose argv "/Users/Stew/.nvm/versions/node/v12.7.0/bin/node" "/Users/Stew/.nvm/versions/node/v12.7.0/bin/npm" "run" "build"
18 verbose node v12.7.0
19 verbose npm v6.10.2
20 error code ELIFECYCLE
21 error errno 1
22 error personal-website#0.1.0 build: `react-scripts build`
22 error Exit status 1
23 error Failed at the personal-website#0.1.0 build script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]
package.json
{
"name": "personal-website",
"version": "0.1.0",
"private": true,
"dependencies": {
"react": "^16.8.6",
"react-dom": "^16.8.6",
"react-scripts": "3.0.1"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"eject": "react-scripts eject"
},
"eslintConfig": {
"extends": "react-app"
},
"browserslist": {
"production": [
">0.2%",
"not dead",
"not op_mini all"
],
"development": [
"last 1 chrome version",
"last 1 firefox version",
"last 1 safari version"
]
}
}
I expect the react project to successfully compile the production build script, but instead it creates the build repository and immediate fails after creating a manifest.json and gives the error message listed above.

npm start not working while installing react

Please see the below files for reference. I am not able to start the npm start command while creating set up for react demo project.
**package.json**
{
"name": "package.json",
"version": "1.0.0",
"description": "Demo application",
"main": "index.js",
"scripts": {
"start": "webpack-dev-server --hot"
},
"author": "Abhishek",
"license": "ISC",
"dependencies": {
"react": "^15.4.2",
"react-dom": "^15.4.2"
}
}
Webpack.config.js
var config = {
entry: './main.js',
output: {
path:'./',
filename: 'index.js',
},
devServer: {
inline: true,
port: 8080
},
module: {
loaders: [
{
test: /\.jsx?$/,
exclude: /node_modules/,
loader: 'babel',
query: {
presets: ['es2015', 'react']
}
}
]
}
}
module.exports = config;
Please find the below logs when I ran npm.start
0 info it worked if it ends with ok
1 verbose cli [ 'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli 'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli 'start' ]
2 info using npm#2.15.1
3 info using node#v4.4.4
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info prestart package.json#1.0.0
6 info start package.json#1.0.0
7 verbose unsafe-perm in lifecycle true
8 info package.json#1.0.0 Failed to exec start script
9 verbose stack Error: package.json#1.0.0 start: `webpack-dev-server --hot`
9 verbose stack Exit status 1
9 verbose stack at EventEmitter.<anonymous> (C:\Program Files\nodejs\node_modules\npm\lib\utils\lifecycle.js:217:16)
9 verbose stack at emitTwo (events.js:87:13)
9 verbose stack at EventEmitter.emit (events.js:172:7)
9 verbose stack at ChildProcess.<anonymous> (C:\Program Files\nodejs\node_modules\npm\lib\utils\spawn.js:24:14)
9 verbose stack at emitTwo (events.js:87:13)
9 verbose stack at ChildProcess.emit (events.js:172:7)
9 verbose stack at maybeClose (internal/child_process.js:827:16)
9 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5)
10 verbose pkgid package.json#1.0.0
11 verbose cwd C:\Users\abhishek_pal02\Desktop\reactApp
12 error Windows_NT 6.3.9600
13 error argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "start"
14 error node v4.4.4
15 error npm v2.15.1
16 error code ELIFECYCLE
17 error package.json#1.0.0 start: `webpack-dev-server --hot`
17 error Exit status 1
18 error Failed at the package.json#1.0.0 start script 'webpack-dev-server --hot'.
18 error This is most likely a problem with the package.json package,
18 error not with npm itself.
18 error Tell the author that this fails on your system:
18 error webpack-dev-server --hot
18 error You can get information on how to open an issue for this project with:
18 error npm bugs package.json
18 error Or if that isn't available, you can get their info via:
18 error
18 error npm owner ls package.json
18 error There is likely additional logging output above.
19 verbose exit [ 1, true ]
Please help to solve this error. Thanks in advance.
-Abhishek

Resources