I wanted to setup webpack and babel with npm, but I got this error
npm ERR! Unexpected end of JSON input while parsing near '...pdragon":"^0.7.0","to' npm ERR! A complete log of this run can be found in:
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\luchan.vladyslav\AppData\Roaming\npm-cache\_logs\2017-12-10T10_48_56_298Z-debug.log
here is my package.json
{
"name": "ddd",
"version": "1.0.0",
"description": "components",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"devDependencies": {
"babel-core": "^6.26.0",
"babel-loader": "^7.1.2",
"babel-preset-env": "^1.6.1"
}
}
At the begining I have tried to install webpack webpack-dev-server babel-core babel-loader and babel-preset-env in one line. But I got this error, after a while I figured out that problem is related to webpack and wepback-dev-server
screenshot
Looks like the corrupt local node_modules is to be blamed. Can you remove the local node_modules folder and then freshly install by `npm install' ? That should fix the issue.
To solve this problem you should clean your cache with
npm cache clean --force
That will solve the problem
Related
I'm using parcel-bundler for sass on my projects, I've always used npm start instead of npm run build and it has always worked for me. But this time, when I try to deploy my project on vercel, it failed and it says "Error: Command "npm run build" exited with 127"?
[19:25:23.101] Cloning github.com/sn-tin/odin-etch-a-sketch (Branch: main, Commit: e5ff000)
[19:25:23.584] Cloning completed: 482.734ms
[19:25:23.676] Installing build runtime...
[19:25:25.452] Build runtime installed: 1.775s
[19:25:26.373] No Build Cache available
[19:25:26.541] Installing dependencies...
[19:25:27.829]
[19:25:27.830] added 17 packages in 1s
[19:25:27.830]
[19:25:27.830] 2 packages are looking for funding
[19:25:27.830] run `npm fund` for details
[19:25:28.030] Detected `package-lock.json` generated by npm 7...
[19:25:28.031] Running "npm run build"
[19:25:28.305]
[19:25:28.306] > odin-eas#1.0.0 build
[19:25:28.306] > parcel build src/index.html
[19:25:28.306]
[19:25:28.322] Error: Command "npm run build" exited with 127
My package.json
{
"name": "odin-eas",
"version": "1.0.0",
"description": "",
"main": "index.js",
"target": {
"main": false
},
"scripts": {
"start": "parcel src/index.html",
"build": "parcel build src/index.html"
},
"keywords": [],
"author": "",
"license": "ISC",
"devDependencies": {
"#parcel/transformer-sass": "^2.5.0",
"bundler": "^0.8.0",
"parcel": "^2.5.0",
"sass": "^1.51.0"
}
}
I got a task to do which is to create some forms with tailwindcss but When I try to launch : npm run build, it does't work. Could you help me?
npm ERR! code ELIFECYCLE
npm ERR! errno 9
npm ERR! widgets#1.0.0 dev: `tailwind build css/tailwind.css -o build/css/tailwind.css`
npm ERR! Exit status 9
npm ERR!
npm ERR! Failed at the widgets#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! /Users/andresbolivar/.npm/_logs/2022-01-21T16_59_01_550Z-debug.log
this is my package.json
{
"name": "widgets",
"version": "1.0.0",
"main": "index.js",
"scripts": {
"dev": "tailwind build style.css -o /css/tailwind.css"
},
"author": "",
"license": "ISC",
"devDependencies": {
"autoprefixer": "^10.4.2",
"postcss": "^8.4.5",
"tailwindcss": "^3.0.15"
},
"dependencies": {},
"description": ""
}
You need to install Tailwind CLI in order to execute tailwind commands:
# Using NPM?
npm install -D tailwindcss
# Using yarn?
yarn add tailwindcss -D
Also, it helps to check the error log (as mentioned in the message printed to your terminal) to find out a full stack trace of the error.
I'm running my first test using percy snapshot using the following command
npm run test:percy
. I got the following error message:
xxx.xxx#LPG002572 TC-Visual % npm run test:percy
npm ERR! missing script: test:percy
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/xxx.xxx/.npm/_logs/2020-04-06T16_11_45_122Z-debug.log
jacqueline.george#LPG002572 TC-Visual % npm run test:percy
npm ERR! missing script: test:percy
However my package.json which I double checked seems to be correct. What did I do wrong, and how do I fix it?
{
"name": "tc-visual",
"version": "1.0.0",
"description": "Visual testing with TestCafe and Percy.io",
"main": "index.js",
"scripts": {
"test": "percy exec -- testcafe chrome ./tests"
},
"keywords": [
"TestCafe",
"percy"
],
"author": "xxx xxx",
"license": "ISC",
"dependencies": {
"#percy/testcafe": "^0.2.0",
"testcafe": "^1.8.3"
}
}
The root cause of this problem is that under 'tests' in the package Json. I made an omission. This is very easy to do. So if anyone else is experiencing this issue please be careful because when you modify your package json. As you can see in the updated code I added test:percy
Please see the updated package json with the correct information
{
"name": "tc-visual",
"version": "1.0.0",
"description": "Visual testing with TestCafe and Percy.io",
"main": "index.js",
"scripts": {
"test:percy": "percy exec -- testcafe chrome ./tests"
},
"keywords": [
"TestCafe",
"Percy"
],
"author": "Author",
"license": "ISC",
"dependencies": {
"#percy/testcafe": "^0.2.0",
"testcafe": "^1.8.3"
}
}
This worked for me.
$ percy exec -- testcafe chrome ./tests
'percy' is not recognized as an internal or external command,
operable program or batch file.
error Command failed with exit code 1
.
yarn add percy or npm install percy
Also percy client was needed after getting this error: Unsupported Percy CLI version, disabling snapshots.
npm install --save-dev #percy/cli
I am trying to use the jsonfile package in my project, but I get the following errors:
Refusing to install package with name <packagename> under a package also called <packagename>. (Note that none of the directory or filename is same as package name)
Cannot find module <packagename>.
The problem is caused when the name of project in package.json is the same as the module you're trying to install.
To solve this problem, please change the project name in package.json to something else. For example, "jsonfile-test":
{
"name": "jsonfile-test",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"dependencies": {
}
}
I think it should be:
npm install --save json-file
not
npm install --save jsonfile
ref: https://www.npmjs.com/package/json-file
If that does not work please try enabling permissions install - e.g. (on mac- but will be equivalent on windows, check: https://helpdeskgeek.com/free-tools-review/5-windows-alternatives-linux-sudo-command/) run:
sudo npm install --save json-file
I cannot figure out how to update a dependent package included in Botkit. After running npm install on the package.json below. Npm warns that the hoek package is vulnerable. I've tried running npm audit fix with no resolution. When I run npm ls hoek it shows botkit installed hoek#2.16.3. I don't see why it would install an out of date version.
//package.json
{
"name": "deleteme",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"dependencies": {
"botkit": "^0.6.16"
}
}
From the npm documentation:
As of npm#2.6.1, the npm update will only inspect top-level packages.
Prior versions of npm would also recursively inspect all dependencies.
To get the old behavior, use npm --depth 9999 update.
See more details here: https://docs.npmjs.com/cli/update