How do I start my React App After I clone it? - javascript

I'm currently trying to deploy my app with netlify, but the problem is that I clone my app into my new computer, and now I'm getting some issues.
> todolistv2#1.0.0 start /Users/hvaandres/Documents/GitHub/TodoList_React
> npm run build
npm ERR! missing script: build
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/hvaandres/.npm/_logs/2021-03-04T06_19_54_506Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! todolistv2#1.0.0 start: `npm run build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the todolistv2#1.0.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! /Users/hvaandres/.npm/_logs/2021-03-04T06_19_54_546Z-debug.log
I ran the following command npm install and I'm still getting the same issue. This is my debug log:
0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/bin/node', '/usr/local/bin/npm', 'run', 'deploy' ]
2 info using npm#6.14.11
3 info using node#v14.15.5
4 verbose run-script [ 'predeploy', 'deploy', 'postdeploy' ]
5 info lifecycle todolistv2#1.0.0~predeploy: todolistv2#1.0.0
6 info lifecycle todolistv2#1.0.0~deploy: todolistv2#1.0.0
7 verbose lifecycle todolistv2#1.0.0~deploy: unsafe-perm in lifecycle true
8 verbose lifecycle todolistv2#1.0.0~deploy: PATH: /usr/local/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/Users/hvaandres/Documents/GitHub/TodoList_React/node_modules/.bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/Apple/usr/bin
9 verbose lifecycle todolistv2#1.0.0~deploy: CWD: /Users/hvaandres/Documents/GitHub/TodoList_React
10 silly lifecycle todolistv2#1.0.0~deploy: Args: [ '-c', 'npm run build && gh-pages -d build' ]
11 silly lifecycle todolistv2#1.0.0~deploy: Returned: code: 1 signal: null
12 info lifecycle todolistv2#1.0.0~deploy: Failed to exec deploy script
13 verbose stack Error: todolistv2#1.0.0 deploy: `npm run build && gh-pages -d build`
13 verbose stack Exit status 1
13 verbose stack at EventEmitter.<anonymous> (/usr/local/lib/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> (/usr/local/lib/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 todolistv2#1.0.0
15 verbose cwd /Users/hvaandres/Documents/GitHub/TodoList_React
16 verbose Darwin 19.6.0
17 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "deploy"
18 verbose node v14.15.5
19 verbose npm v6.14.11
20 error code ELIFECYCLE
21 error errno 1
22 error todolistv2#1.0.0 deploy: `npm run build && gh-pages -d build`
22 error Exit status 1
23 error Failed at the todolistv2#1.0.0 deploy script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]
My package.json:
{
"name": "todolistv2",
"version": "1.0.0",
"description": "Todo-List",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "npm run build"
},
"keywords": [
"react",
"todolist_project"
],
"author": "Alan A. Haro",
"license": "ISC",
"dependencies": {
"react-icons": "^3.11.0"
}
}
If someone can help me, I would really appreciate it. I'm just trying to learn more.

Step 1
you need a Node and Npm in your System
Click here for installing Node.js and npm
Step 2
delete Package-lock.json file
Step 3
For installing Node Modules :
Run Command npm install
Step 4
Run Command npm start
if not working then try Command
npm run build
or
npm run dev
if Still not working then open package.json file
and check
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "npm run build" // your script code is "npm run build"
},

Your package JSON file appears to be missing both a start and build command. Add them back in. These are the defaults for newly created React apps using create-react-app. You also appear to be missing dependencies, namely react and react-dom.
{
"name": "todolistv2",
"version": "1.0.0",
"description": "Todo-List",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "react-scripts start",
"build": "react-scripts build"
},
"keywords": [
"react",
"todolist_project"
],
"author": "Alan A. Haro",
"license": "ISC",
"dependencies": {
"react": "^16.13.1",
"react-dom": "^16.13.1",
"react-icons": "^3.11.0",
... add any other missing dependencies!!
}
}

Related

npm run dev execution webpack error, My webpack is newly installed

My webpack is just installed, the following is my project environment:
webpack.config.js
const path = require('path')
module.exports = {
// 打包模式
mode: "development",
// 打包入口文件
entry: path.join(__dirname, './src/index.js'),
output: {
// 输出文件路径
path: path.join(__dirname, './dist'),
// 输出文件名称
filename: 'bundle.js'
}
}
package.json
{
"name": "test_webpack",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"dev": "webpack"
},
"keywords": [],
"author": "",
"license": "ISC",
"devDependencies": {
"webpack": "^4.41.2",
"webpack-cli": "^3.3.10"
}
}
Execute npm run dev, Output the following
λ npm run dev
> test_webpack#1.0.0 dev D:\WWW\test_webpack
> webpack
#
# Fatal error in , line 0
# Check failed: U_SUCCESS(status).
#
#
#
#FailureMessage Object: 000000A5D21ECF70npm ERR! code ELIFECYCLE
npm ERR! errno 3221225477
npm ERR! test_webpack#1.0.0 dev: `webpack`
npm ERR! Exit status 3221225477
npm ERR!
npm ERR! Failed at the test_webpack#1.0.0 dev 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\cangs\AppData\Roaming\npm-cache\_logs\2019-11-19T07_20_00_087Z-debug.log
C:\Users\cangs\AppData\Roaming\npm-cache_logs\2019-11-19T07_20_00_087Z-debug.log:
0 info it worked if it ends with ok
1 verbose cli [
1 verbose cli 'D:\\Program Files\\nodejs\\node.exe',
1 verbose cli 'D:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli 'run',
1 verbose cli 'dev'
1 verbose cli ]
2 info using npm#6.9.0
3 info using node#v12.0.0
4 verbose run-script [ 'predev', 'dev', 'postdev' ]
5 info lifecycle test_webpack#1.0.0~predev: test_webpack#1.0.0
6 info lifecycle test_webpack#1.0.0~dev: test_webpack#1.0.0
7 verbose lifecycle test_webpack#1.0.0~dev: unsafe-perm in lifecycle true
8 verbose lifecycle test_webpack#1.0.0~dev: PATH: D:\Users\cangs\AppData\Roaming\nvm\v12.0.0\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;D:\WWW\test_webpack\node_modules\.bin;D:\Users\cangs\AppData\Roaming\cmder\bin;D:\Users\cangs\AppData\Roaming\cmder\vendor\bin;D:\Users\cangs\AppData\Roaming\cmder\vendor\conemu-maximus5\ConEmu\Scripts;D:\Users\cangs\AppData\Roaming\cmder\vendor\conemu-maximus5;D:\Users\cangs\AppData\Roaming\cmder\vendor\conemu-maximus5\ConEmu;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\WINDOWS\System32\OpenSSH\;D:\Program Files\Microsoft VS Code\bin;D:\Program Files (x86)\Tencent\QQ\Bin;D:\Program Files\PremiumSoft\Navicat Premium 12;D:\Users\cangs\AppData\Roaming\ffmpeg\bin;D:\Users\cangs\AppData\Roaming\cmder;D:\Users\cangs\AppData\Roaming\nvm;D:\Program Files\nodejs;D:\Users\cangs\AppData\Local\Programs\Python\Python37\Scripts\;D:\Users\cangs\AppData\Local\Programs\Python\Python37\;C:\Users\cangs\AppData\Local\Microsoft\WindowsApps;D:\Program Files\JetBrains\PhpStorm 2019.2.5\bin;C:\Program Files\Bandizip\;D:\Program Files\JetBrains\PyCharm 2019.2.4\bin;D:\Users\cangs\AppData\Roaming\nvm;D:\Program Files\nodejs;D:\Users\cangs\AppData\Roaming\cmder\vendor\git-for-windows\cmd;D:\Users\cangs\AppData\Roaming\cmder\vendor\git-for-windows\mingw64\bin;D:\Users\cangs\AppData\Roaming\cmder\vendor\git-for-windows\usr\bin;D:\Users\cangs\AppData\Roaming\cmder
9 verbose lifecycle test_webpack#1.0.0~dev: CWD: D:\WWW\test_webpack
10 silly lifecycle test_webpack#1.0.0~dev: Args: [ '/d /s /c', 'webpack' ]
11 silly lifecycle test_webpack#1.0.0~dev: Returned: code: 3221225477 signal: null
12 info lifecycle test_webpack#1.0.0~dev: Failed to exec dev script
13 verbose stack Error: test_webpack#1.0.0 dev: `webpack`
13 verbose stack Exit status 3221225477
13 verbose stack at EventEmitter.<anonymous> (D:\Users\cangs\AppData\Roaming\nvm\v12.0.0\node_modules\npm\node_modules\npm-lifecycle\index.js:301:16)
13 verbose stack at EventEmitter.emit (events.js:196:13)
13 verbose stack at ChildProcess.<anonymous> (D:\Users\cangs\AppData\Roaming\nvm\v12.0.0\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
13 verbose stack at ChildProcess.emit (events.js:196:13)
13 verbose stack at maybeClose (internal/child_process.js:1000:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:267:5)
14 verbose pkgid test_webpack#1.0.0
15 verbose cwd D:\WWW\test_webpack
16 verbose Windows_NT 10.0.17763
17 verbose argv "D:\\Program Files\\nodejs\\node.exe" "D:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "dev"
18 verbose node v12.0.0
19 verbose npm v6.9.0
20 error code ELIFECYCLE
21 error errno 3221225477
22 error test_webpack#1.0.0 dev: `webpack`
22 error Exit status 3221225477
23 error Failed at the test_webpack#1.0.0 dev script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 3221225477, true ]
But execute node_modules/.bin/webpack is allowed
λ node_modules\.bin\webpack
#
# Fatal error in , line 0
# Check failed: U_SUCCESS(status).
#
#
#
#FailureMessage Object: 000000A3F1AFD030
I can't know the way to solve the error from the error message output. I hope that more experienced people can help me.

npm run deploy script not giving link

I keep getting this error message when I try to use npm run deploy.
However, I do seem to have a deploy script in my package.json file
I am also cded into the package.json directory
I have tried turning github pages on but when I go to the link it gives me a 404 error
As a result I have turned off github pages
Extended Error message (npm debug log):
14 verbose lifecycle myportfoliosite#0.1.0~deploy: CWD: C:\Users\Ali Haider\AppData\Roaming\npm\node_modules\create-react-app\myportfoliosite\myportfoliosite
15 silly lifecycle myportfoliosite#0.1.0~deploy: Args: [ '/d /s /c', 'gh-pages -d build' ]
16 silly lifecycle myportfoliosite#0.1.0~deploy: Returned: code: 1 signal: null
17 info lifecycle myportfoliosite#0.1.0~deploy: Failed to exec deploy script
18 verbose stack Error: myportfoliosite#0.1.0 deploy: `gh-pages -d build`
18 verbose stack Exit status 1
18 verbose stack at EventEmitter.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\index.js:301:16)
18 verbose stack at EventEmitter.emit (events.js:198:13)
18 verbose stack at ChildProcess.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
18 verbose stack at ChildProcess.emit (events.js:198:13)
18 verbose stack at maybeClose (internal/child_process.js:982:16)
18 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5)
19 verbose pkgid myportfoliosite#0.1.0
20 verbose cwd C:\Users\Ali Haider\AppData\Roaming\npm\node_modules\create-react-app\myportfoliosite\myportfoliosite
21 verbose Windows_NT 10.0.17134
22 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "deploy"
23 verbose node v10.16.0
24 verbose npm v6.9.0
25 error code ELIFECYCLE
26 error errno 1
27 error myportfoliosite#0.1.0 deploy: `gh-pages -d build`
27 error Exit status 1
28 error Failed at the myportfoliosite#0.1.0 deploy script.
28 error This is probably not a problem with npm. There is likely additional logging output above.
29 verbose exit [ 1, true ]
File sizes after gzip:
73.02 KB build\static\js\2.f6e5e996.chunk.js
19.04 KB build\static\css\2.b1979bb4.chunk.css
797 B build\static\js\runtime~main.4f085a03.js
152 B build\static\js\main.a0a932a3.chunk.js
The project was built assuming it is hosted at /InquisitiveDev2016/ReactDeveloperPortfolio/.
You can control this with the homepage field in your package.json.
The build folder is ready to be deployed.
Find out more about deployment here:
Error appearing in terminal:
> myportfoliosite#0.1.0 deploy C:\Users\Ali Haider\AppData\Roaming\npm\node_modules\create-react-app\myportfoliosite\myportfoliosite
> gh-pages -d build
'gh-pages' is not recognized as an internal or external command,
operable program or batch file.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! myportfoliosite#0.1.0 deploy: `gh-pages -d build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the myportfoliosite#0.1.0 deploy 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\Ali Haider\AppData\Roaming\npm-cache\_logs\2019-06-29T02_08_30_836Z-debug.log
Here is my repository: https://github.com/InquisitiveDev2016/ReactDeveloperPortfolio
My json folder:
{
"name": "myportfoliosite",
"version": "0.1.0",
"private": true,
"homepage": "https://github.com/InquisitiveDev2016/ReactDeveloperPortfolio",
"dependencies": {
"react": "^16.8.6",
"react-dom": "^16.8.6",
"react-mdl": "^1.11.0",
"react-router-dom": "^5.0.1",
"react-scripts": "3.0.1"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test",
"predeploy": "npm run build",
"deploy": "gh-pages -d build",
"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"
]
}
}
check your folder tree there you might find build folder there delete catch folder and save then run npm run deploy

Cannot read property 'thisCompilation' of undefined - react-scripts-ts

I created a new project, totally blank using these instructions:
https://developer.microsoft.com/en-us/fabric#/get-started
Follow steps 1-4
The application works fine.
Once I run npm i webpack
Then I get this error
my package.json
{
"name": "lulo",
"version": "0.1.0",
"private": true,
"dependencies": {
"office-ui-fabric-react": "^6.157.0",
"react": "^16.8.4",
"react-adal": "^0.4.22",
"react-dom": "^16.8.4",
"react-scripts-ts": "3.1.0",
"redux": "^4.0.1"
},
"scripts": {
"start": "react-scripts-ts start",
"build": "react-scripts-ts build",
"test": "react-scripts-ts test --env=jsdom",
"eject": "react-scripts-ts eject"
},
"devDependencies": {
"#types/jest": "^24.0.11",
"#types/node": "^11.11.3",
"#types/react": "^16.8.8",
"#types/react-adal": "^0.4.1",
"#types/react-dom": "^16.8.2",
"typescript": "^3.3.3333",
"webpack": "^4.29.6",
"webpack-cli": "^3.3.0"
}
}
the error is this:
Creating an optimized production build...
Starting type checking and linting service...
Using 1 worker with 2048MB memory limit
Failed to compile.
Cannot read property 'thisCompilation' of undefined
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! lulo#0.1.0 build: `react-scripts-ts build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the lulo#0.1.0 build 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! /Users/luisvalencia/.npm/_logs/2019-03-19T21_18_01_997Z-debug.log
and the log file has this
0 info it worked if it ends with ok
1 verbose cli [ '/Users/x/.nvm/versions/node/v10.0.0/bin/node',
1 verbose cli '/Users/x/.nvm/versions/node/v10.0.0/bin/npm',
1 verbose cli 'run-script',
1 verbose cli 'build' ]
2 info using npm#5.6.0
3 info using node#v10.0.0
4 verbose run-script [ 'prebuild', 'build', 'postbuild' ]
5 info lifecycle lulo#0.1.0~prebuild: lulo#0.1.0
6 info lifecycle lulo#0.1.0~build: lulo#0.1.0
7 verbose lifecycle lulo#0.1.0~build: unsafe-perm in lifecycle true
8 verbose lifecycle lulo#0.1.0~build: PATH: /Users/x/.nvm/versions/node/v10.0.0/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/Users/x/Lulo/lulo/node_modules/.bin:/Users/x/.nvm/versions/node/v10.0.0/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin
9 verbose lifecycle lulo#0.1.0~build: CWD: /Users/x/Lulo/lulo
10 silly lifecycle lulo#0.1.0~build: Args: [ '-c', 'react-scripts-ts build' ]
11 silly lifecycle lulo#0.1.0~build: Returned: code: 1 signal: null
12 info lifecycle lulo#0.1.0~build: Failed to exec build script
13 verbose stack Error: lulo#0.1.0 build: `react-scripts-ts build`
13 verbose stack Exit status 1
13 verbose stack at EventEmitter.<anonymous> (/Users/x/.nvm/versions/node/v10.0.0/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:285:16)
13 verbose stack at EventEmitter.emit (events.js:182:13)
13 verbose stack at ChildProcess.<anonymous> (/Users/x/.nvm/versions/node/v10.0.0/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack at ChildProcess.emit (events.js:182:13)
13 verbose stack at maybeClose (internal/child_process.js:947:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:236:5)
14 verbose pkgid lulo#0.1.0
15 verbose cwd /Users/luisvalencia/Lulo/lulo
16 verbose Darwin 18.0.0
17 verbose argv "/Users/x/.nvm/versions/node/v10.0.0/bin/node" "/Users/x/.nvm/versions/node/v10.0.0/bin/npm" "run-script" "build"
18 verbose node v10.0.0
19 verbose npm v5.6.0
20 error code ELIFECYCLE
21 error errno 1
22 error lulo#0.1.0 build: `react-scripts-ts build`
22 error Exit status 1
23 error Failed at the lulo#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 ]
This thread has the answer:
https://github.com/facebook/create-react-app/issues/4076
Basically, delete node_modules and remove webpack from package.json dependencies, then npm install. Some people resolved by using yarn instead of npm.
I too struggled to resolve this error for quite sometime. The problem in my case was due to transitive dependency. Although, "webpack" was not explicitly mentioned as dependency in my project package.json, I found 2 versions of "webpack" in package-lock.json. One was used by "react-scripts" and other by "react-nbsp", which I had mentioned as dependency in package.json, and was using it to get non breaking space in React JSX.
I removed "react-nbsp" from package.json, deleted node-modules, package-lock.json and ran the application. It started without error and worked fine.

Webpack build fails only when webpack.config.js exists

I've searched this to death and haven't found a solution. I'm using webpack for the first time not set up for me via Laravel of Vue.js automated tools. Webpack builds just fine in production or development modes without the webpack.config.js config file present (zero-config mode), but throws a very unhelpful error when I add in the webpack.config.js file to set up the Babel loader. I'm on Windows, if that affects anything.
My package.json:
{
"name": "portfolio_update",
"version": "1.0.0",
"description": "Port to Vue.js",
"main": "src/index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"build": "webpack --mode production",
"dev": "webpack --mode development",
"watch": "webpack --watch --mode production"
},
"author": "Jake Runge",
"license": "ISC",
"devDependencies": {
"babel-core": "^6.26.3",
"babel-loader": "^7.1.4",
"babel-preset-env": "^1.7.0",
"webpack": "^4.12.0",
"webpack-cli": "^3.0.8"
},
"dependencies": {
"jquery": "^3.3.1"
}
}
webpack.config.js:
module.exports = {
module: {
rules: [{
test: /\.js$/,
exclude: /node_modules/,
loader: 'babel-loader'
}]
}
}
unhelpful debug log:
0 info it worked if it ends with ok
1 verbose cli [ 'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli 'C:\\Users\\jwrun\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli 'run',
1 verbose cli 'dev' ]
2 info using npm#5.8.0
3 info using node#v8.9.3
4 verbose run-script [ 'predev', 'dev', 'postdev' ]
5 info lifecycle portfolio_update#1.0.0~predev: portfolio_update#1.0.0
6 info lifecycle portfolio_update#1.0.0~dev: portfolio_update#1.0.0
7 verbose lifecycle portfolio_update#1.0.0~dev: unsafe-perm in lifecycle true
8 verbose lifecycle portfolio_update#1.0.0~dev: PATH: C:\Users\jwrun\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;C:\Bitnami\wampstack-7.1.12-0\apache2\htdocs\Portfolio_update\node_modules\.bin;C:\Program Files (x86)\Intel\iCLS Client\;C:\Program Files (x86)\Common Files\Intel\Shared Libraries\redist\intel64\compiler;C:\Program Files\Intel\iCLS Client\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files\nodejs\;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files\PuTTY\;C:\Bitnami\wampstack-7.1.12-0\php;C:\ProgramData\ComposerSetup\bin;C:\HashiCorp\Vagrant\bin;C:\Program Files\Git\cmd;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\WINDOWS\System32\OpenSSH\;C:\Users\jwrun\AppData\Local\Programs\Python\Python36-32\Scripts\;C:\Users\jwrun\AppData\Local\Programs\Python\Python36-32\;C:\Users\jwrun\AppData\Local\Microsoft\WindowsApps;C:\Users\jwrun\AppData\Local\GitHubDesktop\bin;C:\Users\jwrun\AppData\Roaming\npm;C:\Users\jwrun\AppData\Local\Microsoft\WindowsApps;C:\Users\jwrun\AppData\Roaming\Composer\vendor\bin;C:\Program Files\Microsoft VS Code\bin;C:\Program Files\MongoDB\Server\3.6\bin
9 verbose lifecycle portfolio_update#1.0.0~dev: CWD: C:\Bitnami\wampstack-7.1.12-0\apache2\htdocs\Portfolio_update
10 silly lifecycle portfolio_update#1.0.0~dev: Args: [ '/d /s /c', 'webpack --mode development' ]
11 silly lifecycle portfolio_update#1.0.0~dev: Returned: code: 1 signal: null
12 info lifecycle portfolio_update#1.0.0~dev: Failed to exec dev script
13 verbose stack Error: portfolio_update#1.0.0 dev: `webpack --mode development`
13 verbose stack Exit status 1
13 verbose stack at EventEmitter.<anonymous> (C:\Users\jwrun\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\index.js:283:16)
13 verbose stack at emitTwo (events.js:126:13)
13 verbose stack at EventEmitter.emit (events.js:214:7)
13 verbose stack at ChildProcess.<anonymous> (C:\Users\jwrun\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
13 verbose stack at emitTwo (events.js:126:13)
13 verbose stack at ChildProcess.emit (events.js:214:7)
13 verbose stack at maybeClose (internal/child_process.js:925:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
14 verbose pkgid portfolio_update#1.0.0
15 verbose cwd C:\Bitnami\wampstack-7.1.12-0\apache2\htdocs\Portfolio_update
16 verbose Windows_NT 10.0.17134
17 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\jwrun\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "run" "dev"
18 verbose node v8.9.3
19 verbose npm v5.8.0
20 error code ELIFECYCLE
21 error errno 1
22 error portfolio_update#1.0.0 dev: `webpack --mode development`
22 error Exit status 1
23 error Failed at the portfolio_update#1.0.0 dev script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]
Other setup is standard: There is the recommended src/ folder containing index.js entry point, and a dist/ folder to receive the bundled main.js file. It all works until I create the webpack.config.js file--even blank, with no configuration, I get an error. The file cannot exist or I get an error.
Thanks for any help and guidance anyone can give!
At last, I got it figured out! I wish the answer were complex and difficult to implement, given all the time I've put into this issue, but it was as simple as updating my Node and NPM versions.
I updated NPM from 5.8.0 to 6.1.0; I updated Node from 8.9.3 to the most recent, 10.4.1. Webpack does not need specified entry and output settings in the config file.
This was fairly unscientific, so I'm not sure if it was the Node upgrade or the NPM upgrade that helped, or if I could have updated to a less recent version of either--but if anyone else is having trouble, try a more recent Node or NPM version.

Unable to run scripts on npm from fresh install

Alright, so I freshly installed NodeJS 9.5.0 and double-checked to see that npm is on the most updated version (5.6.0), and so far I've been having issues with running a simple script from the package.json file.
Here's what I have under the package.json file.
{
"name": "hello_world",
"version": "1.0.0",
"description": "lab-4-hello-world-app",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
"start": "node index.js"
},
"author": "Java Drinker",
"license": "ISC"
}
And here is my index.js . Thankfully, Node is able to run it just fine from cli.
console.log("Hello Java Drinker!");
Below this is the error message I received from trying to run the "start" script with the debug log following it.
npm ERR! file C:\test\package.json
npm ERR! code EJSONPARSE
npm ERR! Failed to parse json
npm ERR! Unexpected string in JSON at position 187 while parsing '{
npm ERR! "name": "hello_world",
npm ERR! "version": '
npm ERR! File: C:\test\package.json
npm ERR! Failed to parse package.json data.
npm ERR! package.json must be actual JSON, not just JavaScript.
npm ERR!
npm ERR! Tell the package author to fix their package.json file. JSON.parse
2018-02-22T07_49_53_423Z-debug.log
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 'run',
1 verbose cli 'start' ]
2 info using npm#5.6.0
3 info using node#v9.5.0
4 verbose stack Error: Failed to parse json
4 verbose stack Unexpected string in JSON at position 187 while parsing '{
4 verbose stack "name": "hello_world",
4 verbose stack "version": '
4 verbose stack at parseError (C:\Program Files\nodejs\node_modules\npm\node_modules\read-package-json\read-json.js:436:11)
4 verbose stack at parseJson (C:\Program Files\nodejs\node_modules\npm\node_modules\read-package-json\read-json.js:104:26)
4 verbose stack at C:\Program Files\nodejs\node_modules\npm\node_modules\read-package-json\read-json.js:51:5
4 verbose stack at C:\Program Files\nodejs\node_modules\npm\node_modules\graceful-fs\graceful-fs.js:78:16
4 verbose stack at FSReqWrap.readFileAfterClose [as oncomplete] (fs.js:528:3)
5 verbose cwd C:\test
6 verbose Windows_NT 10.0.16299
7 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "start"
8 verbose node v9.5.0
9 verbose npm v5.6.0
10 error file C:\test\package.json
11 error code EJSONPARSE
12 error Failed to parse json
12 error Unexpected string in JSON at position 187 while parsing '{
12 error "name": "hello_world",
12 error "version": '
13 error File: C:\test\package.json
14 error Failed to parse package.json data.
14 error package.json must be actual JSON, not just JavaScript.
14 error
14 error Tell the package author to fix their package.json file. JSON.parse
15 verbose exit [ 1, true ]
I'd like to add that I can run npm -v just fine.. but it seems like any other command just causes errors for me. I guess I'm installing npm incorrectly..?
Make sure your package.json file is valid. In the provided sample, you need to add a missing comma , after the test script (end of line 6):
{
"name": "hello_world",
"version": "1.0.0",
"description": "lab-4-hello-world-app",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "node index.js"
},
"author": "Java Drinker",
"license": "ISC"
}

Categories

Resources