npm run build - Insufficient number of arguments or no entry found - npm

I am trying to build a project for the first time and I am getting an error message.
Insufficient number of arguments or no entry found.
Alternatively, run 'webpack(-cli) --help' for usage info.
Hash: 83fdf40d8aadb2841816
Version: webpack 4.18.0
Time: 180ms
Built at: 09/11/2018 4:55:53 AM
ERROR in Entry module not found: Error: Can't resolve './src' in '/home/baudhi/website'
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! website#15.19.1 build: `webpack --mode production`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the website#15.19.1 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! /home/baudhi/.npm/_logs/2018-09-11T11_55_53_650Z-debug.log
The ebook I am reading has asked me to type 'npm run build' but it is not working. any help pls.
My package.json file looks like the following:
{
"name": "website",
"version": "15.19.1",
"description": "just practice",
"main": "main.js",
"scripts": {
"develop": "webpack --mode development --watch",
"build": "webpack --mode production"
},
"author": "pebaudhi",
"license": "ISC",
"devDependencies": {
"webpack": "^4.18.0",
"webpack-cli": "^3.1.0"
},
"dependencies": {
"jquery": "^3.3.1"
}
}
And my directory structure is:
/usr/baudhi/website/.babelrc
/usr/baudhi/website/package.json
/usr/baudhi/website/jquery-3.3.1.js
/usr/baudhi/website/src/main.js
/usr/baudhi/website/dist/main.js
node -v
v10.7.0
Thank you very much for helping me.

If you're using Webpack 4 the configuration has been defaulted. Hence, you don't need to provide a webpack.config.json file but you're project needs to follow the default config.
The default entry point in Webpack 4 is ./src/index.js. So either rename ./src/main.js or create webpack.config.js file with the following minimum.
module.exports = {
entry: './src/main.js'
};

Related

Cypress Github Actions showing peer dependency conflict errors

I'm trying to set up a workflow to run automated cypress tests in GitHub Actions but continue to run into this error message
npm ERR! While resolving: cypress-plugin-snapshots#1.4.4
npm ERR! Found: cypress#8.4.1
npm ERR! node_modules/cypress
npm ERR! dev cypress#"^8.4.1" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer cypress#"^4.5.0" from cypress-plugin-snapshots#1.4.4
npm ERR! node_modules/cypress-plugin-snapshots
npm ERR! dev cypress-plugin-snapshots#"1.4.4" from the root project
npm ERR!
npm ERR! Conflicting peer dependency: cypress#4.12.1
npm ERR! node_modules/cypress
npm ERR! peer cypress#"^4.5.0" from cypress-plugin-snapshots#1.4.4
npm ERR! node_modules/cypress-plugin-snapshots
npm ERR! dev cypress-plugin-snapshots#"1.4.4" from the root project
I don't have permission to embed images, but here's a screenshot of the entire error message
Relevant section of the YAML workflow:
jobs:
cypress-run:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout#v3
- name: Cypress Run
uses: cypress-io/github-action#v4
with:
build: npm run build
start: npm start
spec: cypress/integration/example.js
package.json:
{
"name": "cypressautomations",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"cypress:open": "cypress open",
"cypress:debug": "cross-env CYPRESS_REMOTE_DEBUGGING_PORT=9222 cypress open",
"delete-mochawesome-folder": "rm -f mochawesome-report/*.json",
"e2e_mochawesome": "yarn cypress run --spec cypress/integration/Tests/*.js",
"merge-json": "npx mochawesome-merge --reportDir mochawesome-report > mochawesome1.json",
"html-generator": " npx mochawesome-report-generator mochawesome1.json"
},
"author": "",
"license": "ISC",
"devDependencies": {
"#cypress/snapshot": "2.1.7",
"cross-env": "7.0.3",
"cypress": "^8.4.1",
"cypress-fail-on-console-error": "2.0.6",
"cypress-multi-reporters": "1.4.0",
"cypress-plugin-snapshots": "1.4.4",
"cypress-wait-until": "1.7.1",
"eslint": "7.26.0"
},
"dependencies": {
"#azure/cosmos": "3.10.5",
"bson-ext": "4.0.1",
"dotenv": "8.2.0",
"kerberos": "1.1.7",
"lodash": "4.17.21",
"mocha-junit-reporter": "2.0.0",
"mochawesome": "6.2.2",
"mochawesome-merge": "4.2.0",
"mochawesome-report-generator": "5.2.0",
"mongodb": "4.1.2",
"mongodb-client-encryption": "1.2.7"
},
"peerDependencies": {
"mocha": "3.1.2"
}
}
I tried doing a run with the --legacy-peer-deps flag by adding the following code after the "Checkout" step
- name: Install Dependencies
run: npm ci --legacy-peer-deps
but the error persists. It looks like the 'Cypress Run' action runs the 'npm ci' command as part of its own workflow, even if dependencies are already installed.
Any insight into this problem would be greatly appreciated.
I was running into the same issue and figured the same thing with the Cypress Run command. It's doing the npm installation for you.
I fixed this by separating the installation from the action and build, as well as setting the action installation as false:
steps:
- name: Checkout
uses: actions/checkout#v2
# Install NPM dependencies, cache them correctly
# and run all Cypress tests
- name: Cypress install
run: npm install --legacy-peer-deps
- name: Cypress run
uses: cypress-io/github-action#v2
with:
install: false
build: npm run build
start: npm start
run: npm run dev
Cypress is now running my E2E tests.

Failure to install node modules within react native app in a mono repo using pnpm

i'm attempting to run a react native app in a monorepo using pnpm. I added it to pnpm-workspace.yaml file defined as:
packages:
- "apps/*"
When i attempt to run npm i or pnpm i i kept getting the error below:
> sample_project#0.0.1 prepare
> cd .. && husky install frontend/.husky
line 2: husky: command not found
I have husky defined in the root folder(within pnpm-workspace.yaml). Also i declared a .npmrc file that included node-linker=hoisted but still no luck. I also ran pnpm i within the root directory but failed to install node_modules dir within the mobile directory. Please help needed. How does one run a react native app within a monorepo with pnpm? Any help will be appreciated.
Edit
I have husky defined in the root directory as:
#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"
cd frontend
pnpm run pre-commit
and in my package.json file:
{
"name": "sample_project",
"version": "0.0.1",
"private": true,
"workspaces": [
"apps/*",
"packages/*"
],
"scripts": {
"build": "turbo run build",
"dev": "turbo run dev --parallel",
"test": "turbo run test",
"test:lint": "turbo run test:lint",
"fix": "turbo run fix",
"format": "prettier --write \"**/*.{ts,tsx,md}\"",
"prepare": "cd .. && husky install frontend/.husky",
"pre-commit": "turbo run fix"
},
"devDependencies": {
"prettier": "latest",
"turbo": "latest",
"husky": "latest",
"lint-staged": "latest"
},
"engines": {
"npm": ">=7.0.0",
"node": ">=14.0.0"
},
"packageManager": "pnpm#7.0.1"
}
When i run the command npm i --loglevel verbose within the mobile directory below is the following errors:
> sample_project#0.0.1 prepare
> cd .. && husky install frontend/.husky
/var/folders/r5/n6lp6wsj2c52h51xxsdgw7y00000gn/T/prepare6589946269.sh: line 2: husky: command not found
npm timing command:i Completed in 54463ms
npm verb stack Error: command failed
npm verb stack at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/#npmcli/promise-spawn/lib/index.js:63:27)
npm verb stack at ChildProcess.emit (node:events:513:28)
npm verb stack at maybeClose (node:internal/child_process:1091:16)
npm verb stack at ChildProcess._handle.onexit (node:internal/child_process:302:5)
npm verb pkgid ***#0.0.1
npm verb cwd /Users/***/***/***/***/***/****
npm verb Darwin 21.5.0
npm verb node v18.6.0
npm verb npm v8.13.2
npm ERR! code 127
npm ERR! path /Users/***/***/***/***
npm ERR! command failed
npm ERR! command sh -c /var/folders/r5/n6lp6wsj2c52h51xxsdgw7y00000gn/T/prepare6589946269.sh
npm verb exit 127
npm timing npm Completed in 54564ms
npm verb code 127

Having different errors with vue create and npm run serve

I'm new to vue and I'm having different errors trying to create new projects with vue create and executing npm run serve.
I've already tried reinstalling node and vue. Changed some PATH, but nothing worked.
First I created the application with:
vue create routing-overview
Then i got this in the final part:
added 1259 packages from 656 contributors in 37.319s
🚀 Invoking generators...
📦 Installing additional dependencies...
npm ERR! code EEXIST
npm ERR! path C:\Users\USER\Estudos\igti\m04-vue\routing-overview\node_modules\#babel\parser\bin\babel-parser.js
npm ERR! dest C:\Users\USER\Studies\m04-vue\routing-overview\parser
npm ERR! EEXIST: file already exists, cmd shim 'C:\Users\USER\Studies\m04-vue\routing-overview\node_modules\#babel\parser\bin\babel-parser.js' -> 'C:\Users\USER\Studies\m04-vue\routing-overview\parser'
npm ERR! File exists: C:\Users\USER\Studies\m04-vue\routing-overview\parser
npm ERR! Remove the existing file and try again, or run npm
npm ERR! with --force to overwrite files recklessly.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\USER\AppData\Roaming\npm-cache\_logs\2021-09-10T19_38_16_412Z-debug.log
ERROR command failed: npm install --loglevel error
Opening the project folder on VS Code I have this error in the first import of main.js:
Parsing error: Cannot find module 'babel-eslint'
Require stack:
- C:\Users\USER\Studies\m04-vue\routing-overview\node_modules\vue-eslint-parser\index.js
- C:\Users\USER\Studies\m04-vue\routing-overview\node_modules\eslint-plugin-vue\lib\utils\index.js
- C:\Users\USER\Studies\m04-vue\routing-overview\node_modules\eslint-plugin-vue\lib\rules\array-bracket-newline.js
- C:\Users\USER\Studies\m04-vue\routing-overview\node_modules\eslint-plugin-vue\lib\index.js
- C:\Users\USER\Studies\m04-vue\routing-overview\node_modules\eslint\lib\cli-engine\config-array-factory.js
- C:\Users\USER\Studies\m04-vue\routing-overview\node_modules\eslint\lib\cli-engine\cascading-config-array-factory.js
- C:\Users\USER\Studies\m04-vue\routing-overview\node_modules\eslint\lib\cli-engine\cli-engine.js
- C:\Users\USER\Studies\m04-vue\routing-overview\node_modules\eslint\lib\cli-engine\index.js
- C:\Users\USER\Studies\m04-vue\routing-overview\node_modules\eslint\lib\api.js
- c:\Users\USER\.vscode\extensions\dbaeumer.vscode-eslint-2.1.25\server\out\eslintServer.js
And when I try to npm run serve, i have a different error:
> routing-overview#0.1.0 serve C:\Users\USER\Studies\m04-vue\routing-overview
> vue-cli-service serve
internal/modules/cjs/loader.js:892
throw err;
^
Error: Cannot find module '#vue/cli-plugin-babel'
Require stack:
- C:\Users\USER\Studies\m04-vue\routing-overview\node_modules\#vue\cli-service\lib\Service.js
- C:\Users\USER\Studies\m04-vue\routing-overview\node_modules\#vue\cli-service\bin\vue-cli-service.js
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:889:15)
at Function.Module._load (internal/modules/cjs/loader.js:745:27)
at Module.require (internal/modules/cjs/loader.js:961:19)
at require (internal/modules/cjs/helpers.js:92:18)
at idToPlugin (C:\Users\USER\Studies\m04-vue\routing-overview\node_modules\#vue\cli-service\lib\Service.js:145:14)
at C:\Users\USER\Studies\m04-vue\routing-overview\node_modules\#vue\cli-service\lib\Service.js:184:20
at Array.map (<anonymous>)
at Service.resolvePlugins (C:\Users\USER\Studies\m04-vue\routing-overview\node_modules\#vue\cli-service\lib\Service.js:170:10)
at new Service (C:\Users\USER\Studies\m04-vue\routing-overview\node_modules\#vue\cli-service\lib\Service.js:32:25)
at Object.<anonymous> (C:\Users\USER\Studies\m04-vue\routing-overview\node_modules\#vue\cli-service\bin\vue-cli-service.js:15:17) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'C:\\Users\\USER\\Studies\\m04-vue\\routing-overview\\node_modules\\#vue\\cli-service\\lib\\Service.js',
'C:\\Users\\USER\\Studies\\m04-vue\\routing-overview\\node_modules\\#vue\\cli-service\\bin\\vue-cli-service.js'
]
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! routing-overview#0.1.0 serve: `vue-cli-service serve`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the routing-overview#0.1.0 serve 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\2021-09-10T19_48_28_445Z-debug.log
And this is what I have on package.json:
{
"name": "routing-overview",
"version": "0.1.0",
"private": true,
"scripts": {
"serve": "vue-cli-service serve",
"build": "vue-cli-service build",
"lint": "vue-cli-service lint"
},
"dependencies": {
"core-js": "^3.6.5",
"vue": "^3.0.0"
},
"devDependencies": {
"#vue/cli-plugin-babel": "~4.5.0",
"#vue/cli-plugin-eslint": "~4.5.0",
"#vue/cli-service": "~4.5.0",
"#vue/compiler-sfc": "^3.0.0",
"babel-eslint": "^10.1.0",
"eslint": "^6.7.2",
"eslint-plugin-vue": "^7.0.0"
},
"eslintConfig": {
"root": true,
"env": {
"node": true
},
"extends": [
"plugin:vue/vue3-essential",
"eslint:recommended"
],
"parserOptions": {
"parser": "babel-eslint"
},
"rules": {}
},
"browserslist": [
"> 1%",
"last 2 versions",
"not dead"
]
}
I have no idea what is the problem. Any help is very much appreciated.
Try running:
$ npm install
in the same folder of your package.json file, then try it again.
Have you tried updating npm and node versions?. It's possible you need to update them.
Also, you can try cleaning npm cache data: npm cache clean --force . or you can do it manually by locating appData folder and then \npm-cache folder and delete it. then try running vue create routing-overview again
I was able to fix the problem, even not having a clue about what exactly was wrong.
I uninstalled vue and then Node from my PC. After that, I deleted any trace of node or npm from my PC following the comments from this post.
Then installed Node again and #vue/cli. Used npm init to create a new package.JSON and everything is working as expected right now.
Thanks for the help!

Cannot find module 'live-server' (locally installed)

I have been trying to run babel and live-server locally , however when calling for 'npm run build' or 'npm run serve' I get the following error:
> boilerplate#1.0.0 serve C:\Users\sasaa\OneDrive\Documents\HTMl&CSS\j-14-05-globals\boilerplate
> live-server public
'CSS\j-14-05-globals\boilerplate\node_modules\.bin\' is not recognized as an internal or external command,
operable program or batch file.
internal/modules/cjs/loader.js:969
throw err;
^
Error: Cannot find module 'C:\Users\sasaa\OneDrive\Documents\live-server\live-server.js'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:966:17)
at Function.Module._load (internal/modules/cjs/loader.js:859:27)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
at internal/main/run_main_module.js:17:47 {
code: 'MODULE_NOT_FOUND',
requireStack: []
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! boilerplate#1.0.0 serve: `live-server public`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the boilerplate#1.0.0 serve 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\sasaa\AppData\Roaming\npm-cache\_logs\2020-01-05T00_21_18_216Z-debug.log
This is the package-json:
{
"name": "boilerplate",
"version": "1.0.0",
"description": "",
"main": "input.js",
"scripts": {
"serve": "live-server public",
"build": "babel src/index.js --out-file public/scripts/bundle.js --presets env --watch"
},
"author": "",
"license": "ISC",
"dependencies": {
"babel-cli": "^6.26.0",
"babel-preset-env": "^1.6.1",
"live-server": "^1.2.1"
}
}
I am using Windows 10 with Git Bash
npm version 6.13.4
node v13.5.0
Any suggestions how to solve this issue?

is there a way to fix 'npm ERR! code ELIFECYCLE in react.js'"

I'm trying to create an application using Django framework as a back-End and React.js as the front-End. the django portion works just fine, but when trying to integrate the react with my app. I get npm ERR! code ELIFECYCLE
npm ERR! errno 2. I am fairly new to this technology and I don't quiet understand where the error is coming from.
I tried cleaning up the cache and deleting the node_modules repo and then npm install but it didn't work. so i turn to you asking for help skilled programmers
this the error i get:
ERROR in Entry module not found: Error: Can't resolve './gentelella/frontend/src/index.js' in 'C:\Users\USER\Desktop\finale\django-gentelella\gentelella'
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! gentelella#1.0.0 build: `webpack --mode production ./gentelella/frontend/src/index.js --output ./gentelella/frontend/static/frontend/main.js`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the gentelella#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\AppData\Roaming\npm-cache\_logs\2019-05-22T10_24_53_635Z-debug.log
and this is the package.json:
{
"name": "gentelella",
"version": "1.0.0",
"description": "",
"main": "index.js",
"dependencies": {
"prop-types": "^15.7.2",
"react": "^16.8.6",
"react-dom": "^16.8.6"
},
"devDependencies": {
"#babel/core": "^7.4.4",
"#babel/preset-env": "^7.4.4",
"#babel/preset-react": "^7.0.0",
"babel-loader": "^8.0.6",
"babel-plugin-transform-class-properties": "^6.24.1",
"webpack": "^4.32.0",
"webpack-cli": "^3.3.2"
},
"scripts": {
"dev": "webpack --mode development ./gentelella/frontend/src/index.js --output ./gentelella/frontend/static/frontend/main.js",
"build": "webpack --mode production ./gentelella/frontend/src/index.js --output ./gentelella/frontend/static/frontend/main.js"
},
"keywords": [],
"author": "",
"license": "ISC"
}
It seems to me like your path is wrong. Try using removing the gantelella folder from the path, so this leaves 'frontend/src/index.js'.
This assumes you have structured your folders like this:
C:\Users\USER\Desktop\finale\django-gentelella\gentelella\frontend\src\index.js