I am using webpack to build my app so I am getting the following error on command prompt:
forkify#1.0.0 dev D:\Myprograms\java script\forkify
webpack --mode development
Insufficient number of arguments or no entry found.
Alternatively, run 'webpack(-cli) --help' for usage info.
Hash: 750054014bbd689a84a8
Version: webpack 4.16.5
Time: 85ms
Built at: 2018-08-07 10:22:56
ERROR in Entry module not found: Error: Can't resolve './scr/js/index.js' in 'D:\Myprograms\java script\forkify'
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! forkify#1.0.0 dev: webpack --mode development
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the forkify#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\Acer\AppData\Roaming\npm-cache_logs\2018-08-07T04_52_57_041Z-debug.log
My webpack.config.js is as follows:
const path = require('path');
module.exports = {
entry: './scr/js/index.js',
output: {
path: path.resolve(__dirname,'dist/js'),
filename: 'bundle.js'
}
};
My package.json file as follows:
{
"name": "forkify",
"version": "1.0.0",
"description": "forkify project",
"main": "index.js",
"scripts": {
"dev": "webpack --mode development",
"build": "webpack --mode production"
},
"author": "abhilash narayan",
"license": "ISC",
"devDependencies": {
"webpack": "^4.16.5",
"webpack-cli": "^3.1.0"
}
}
Also check the screen shots
My file structure webpack.conifg.js:
It looks to me like a spelling mistake, entry: './scr/js/index.js
try to change it to ./src/js/index.js
Related
I,m trying to run 'npm run build' but always get error, 'npm run start' command is run correcly,but build command not run.:(
{
"name": "films",
"version": "1.0.0",
"description": "contain about films",
"default": "index.html",
"scripts": {
"start": "parcel index.html",
"build": "parcel build index.html --dist-dir ./dist "
},
"author": "chathura priyashan",
"license": "ISC",
"devDependencies": {
"parcel": "^2.3.2"
},
"dependencies": {
"node-sass": "^7.0.1"
}
}
err--------------------------------------------------
npm ERR! code ELIFECYCLE
npm ERR! errno 3221225501
npm ERR! films#1.0.0 build: `parcel build index.html `
npm ERR! Exit status 3221225501
npm ERR!
npm ERR! Failed at the films#1.0.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! C:\Users\chathura\AppData\Roaming\npm-cache\_logs\2022-03-28T14_56_48_033Z-debug.log
PS G:\java script sites\Asynchronus\films> npm run build
I am trying to use node for the first time,installed node.js below is the information
node -v
v14.4.0
npm -v
6.14.5
Completed the setup by creating a package.json file, then tried to install lite-server using the command
npm install lite-server --save-dev produced the folllowing error:
npm WARN deprecated chokidar#2.1.8: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.
npm ERR! cb() never called!
npm ERR! This is an error with npm itself. Please report this error at:
npm ERR! <https://npm.community>
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\ojhaa\AppData\Roaming\npm-cache\_logs\2020-06-06T06_54_54_480Z-debug.log
Followed by
npm cache clean --force
Here is the package.json file
{
"name": "git-test",
"version": "1.0.0",
"description": "\"This is a test directory to learn git and node\"",
"main": "index.html",
"scripts": {
"start": "npm run lite",
"test": "echo \"Error: no test specified\" && exit 1",
"lite": "lite-server"
},
"repository": {
"type": "git",
"url": "git+https://github.com/apoorva0212/git-test.git"
},
"author": "\"Apoorva Ojha\"",
"license": "ISC",
"bugs": {
"url": "https://github.com/apoorva0212/git-test/issues"
},
"homepage": "https://github.com/apoorva0212/git-test#readme"
}
But still I get the same error. Can anyone help me with this?
Thank you, in advance.
you are missing the dependency on lite-server
try to install lite-server dependency
npm install lite-server --save-dev
then invoke npm run lite
I am currently taking a course on Udemy and I am stuck, I am having a problem running script. When I run the command npm run dev, I get this error message:
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! forkify#1.0.0 dev: `webpack`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the forkify#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\user\AppData\Roaming\npm-cache\_logs\2020-05-01T10_10_11_136Z-debug.log
What would be wrong? This is my package.json code:
{
"name": "forkify",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"dev": "webpack",
"build": "webpack --mode production",
"start": "webpack-dev-server --mode development --open"
},
"author": "Marv",
"license": "ISC",
"devDependencies": {
"babel-core": "^6.26.3",
"babel-loader": "^7.1.5",
"babel-preset-env": "^1.7.0",
"html-webpack-plugin": "^3.2.0",
"webpack": "^4.28.4",
"webpack-cli": "^3.2.1",
"webpack-dev-server": "^3.1.14"
},
"dependencies": {
"babel-polyfill": "^6.26.0"
}
}
Here is the webpack.config.js code:
const path = require('path');
module.exports = {
entry: './src/js/index.js',
output: {
path: path.resolve(__dirname, 'dist/js'),
filename: 'bundle.js'
},
mode: 'development'
};
What could be wrong?
UPDATE: Some way I was able to finally npm run dev but it is being created in the wrong directory. How can I solve this?
I need it to appear under the starter > dist > js
Your path are not good replace entry: './src/js/index.js' by entry: './started/src/js/index.js'
I try to run typescript files with just a package.json file. So a minimum setup for running typescript files.
I just have a singel file: index.ts:
console.clear();
console.log("nic to see you!!");
and package.json file:
{
"name": "Todo",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "node index.js"
},
"keywords": [],
"author": "",
"license": "ISC"
}
But if I try to do :
npm start, I will get this error:
Error: Cannot find module 'D:\Mijn Documents\UDEMY\TypeScript\Todo\index.js'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
at Function.Module._load (internal/modules/cjs/loader.js:562:25)
at Function.Module.runMain (internal/modules/cjs/loader.js:831:12)
at startup (internal/bootstrap/node.js:283:19)
at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! Todo#1.0.0 start: `node index.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the Todo#1.0.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm WARN Local package.json exists, but node_modules missing, did you mean to install?
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\User.USER-PC\AppData\Roaming\npm-cache\_logs\2019-12-24T11_22_12_024Z-debug.log
PS D:\Mijn Documents\UDEMY\TypeScript\Todo>
So my question is: what I have to change that it will compile?
Thank you
oke, I have it now like this:
packagege.json:
{
"name": "Todo",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"build":"tsc -p ./src",
"start": "npm run build -- -w"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"ts-node": "^8.5.4",
"typescript": "^3.7.4"
}
}
And I installed typescript
and I do: npm start. I still get this error:
npm run build -- -w
> Todo#1.0.0 build D:\Mijn Documents\UDEMY\TypeScript\Todo
> tsc -p ./src "-w"
error TS5057: Cannot find a tsconfig.json file at the specified directory: './src'.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! Todo#1.0.0 build: `tsc -p ./src "-w"`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the Todo#1.0.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! C:\Users\User.USER-PC\AppData\Roaming\npm-cache\_logs\2019-12-24T11_33_38_340Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! Todo#1.0.0 start: `npm run build -- -w`
npm ERR! Exit status 1
oke, I have it now like this:
{
"name": "Todo",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"build": "tsc main.ts dist/",
"start": "npm run build -- -w"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"ts-node": "^8.5.4",
"typescript": "^3.7.4"
}
}
and if I do this: npm run. I see this output:
> Todo#1.0.0 build D:\Mijn Documents\UDEMY\TypeScript\Todo
> tsc main.ts dist/ "-w"
[1:46:58 PM] Starting compilation in watch mode...
error TS6053: File 'dist/.ts' not found.
[1:46:59 PM] Found 1 error. Watching for file changes.
oke, I see now this:
> Todo#1.0.0 build D:\Mijn Documents\UDEMY\TypeScript\Todo
> tsc -p ./ "-w"
[2:00:31 PM] Starting compilation in watch mode...
[2:00:34 PM] Found 0 errors. Watching for file changes.
But where I can see the results then? Will be nice to go to some port, like: localhost:4200 in the browser, but how to do that?
Try typing in the terminal as follows:
ts-node ./src/index.ts
Or, try the following modifications to the "start" script:
"start": "ts-node ./src/index.ts"
Thank you all!!
the trick was this in the package.json:
"start": "tsc-watch --onsuccess \"node dist/index.js\""
Trying to run jsHint via script.
package.json:
{
"name": "projectName",
"version": "0.1.0",
"devDependencies": {
"jshint": "^2.9.1"
},
"scripts": {
"lint": "jshint src"
}
}
And get the following error:
npm ERR! Darwin 15.0.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "lint"
npm ERR! node v4.2.4
npm ERR! npm v2.14.12
npm ERR! code ELIFECYCLE
npm ERR! projectName#0.1.0 lint: `jshint src`
npm ERR! Exit status 2
I resolved this adding "|| true" to the lint line of the script in my package.json file. See below:
{
"name": "projectName",
"version": "0.1.0",
"devDependencies": {
"jshint": "^2.9.1"
},
"scripts": {
"lint": "jshint src || true"
}
}