I am unable to get the command that should help me in running the website on local host - web

Here is package.json
{
"name": "complete",
"version": "1.0.0",
"description": "Implemented an ethereum smart contract in Solidity to develop an online MarketPlace
where people can buy, sell products, ask for a refund, check transaction status etc. The client side
pages are served by a Flask server.",
"main": "truffle-config.js",
"directories": {
"test": "test"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC"
}
Here is the error
npm run test
> complete#1.0.0 test F:\complete
> echo "Error: no test specified" && exit 1
"Error: no test specified"
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! complete#1.0.0 test: `echo "Error: no test specified" && exit 1`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the complete#1.0.0 test 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\HP\AppData\Roaming\npm-cache\_logs\2020-02-04T08_30_37_917Z-debug.log

You must provide test command in the script field.
eg: I use mocha for testing
"scripts": {
"test": "mocha"
}

Related

how to fix "npm ERR! Missing script:"

I wrote the script "style", but for some reason does not want to execute it.
Using the npm run command, you can just execute the script "test": "echo "Error: no test specified" && exit 1"
My package.json is below, as well as the full error message when I run a command:
{
"name": "plants",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"style": "sass sass/style.scss sass/style.css",
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC"
}
here I am trying to run a sktipt:
npm run style
npm ERR! Missing script: "style"
npm ERR!
npm ERR! To see a list of scripts, run:
npm ERR! npm run
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\GRAFIK548\AppData\Local\npm-cache\_logs\2022-12-28T06_18_17_306Z-debug-0.log
and here I look at what scripts can be run:
$ npm run
Lifecycle scripts included in plants#1.0.0:
test
echo "Error: no test specified" && exit 1
in general, I'm trying to connect sass via json
thank you very much for any answer!!
NPM err missing script fix
I used to get this error a lot on my old computer. The easiest fix I found that worked was to just
Try to use the absolute path of the file in your JSON.

"node server.js" works, but "npm start"cannot find node

Answers to similar questions here and here do not resolve my issue.
In an empty directory I create a file 'server.js' all it does is a console.log('hello'). Running this file with "node server.js" runs fine. But after "npm init -y" running through "npm start" gives:
npm start
The system cannot find the path specified.
> prj#1.0.0 start E:\projects\prj
> node server.js
/bin/bash: node: command not found
npm ERR! code ELIFECYCLE
npm ERR! syscall spawn
npm ERR! file bash
npm ERR! errno ENOENT
npm ERR! prj#1.0.0 start: `node server.js`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the prj#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?
The detailed logfile reports correct versions of npm and node. And all of this is after an uninstall/reinstall of node.js.
Any hints on how to troubleshoot/fix appreciated.
project directory:
E:\prj
package.json
package-lock.json
server.js
package.json is the default after npm init:
{
"name": "prj",
"version": "1.0.0",
"description": "",
"main": "server.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "node server.js"
},
"keywords": [],
"author": "",
"license": "ISC"
}

Why does npm run build for babel throw an error: "babel: src does not exist"

My folder is src and I've installed babel via the CLI, yet I'm still getting an error, "babel:
src does not exist"
Here's a quick recording of of my code: https://drive.google.com/file/d/1YgEnJE87c0mEnsefY1xU94cvUedBtGhK/view
See above what I've tried.
{
"name": "notes-app",
"version": "1.0.0",
"description": "",
"main": "app.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"build": "babel src -d lib"
},
"author": "Jono Suave",
"license": "ISC",
"devDependencies": {
"#babel/cli": "^7.7.0",
"#babel/core": "^7.7.2"
}
}
app.js
import getNotes from "notes.js"
getNotes()
notes.js
let getNotes = function() {
console.log(`Put the time in baby!`)
}
module.exports = getNotes
I expected babel to run and compile my ES6 import code in app.js, but instead received following error in terminal:
babel:
src does not exist
npm ERR! code ELIFECYCLE
npm ERR! errno 2
npm ERR! notes-app#1.0.0 build: `babel src -d lib`
npm ERR! Exit status 2
npm ERR!
npm ERR! Failed at the notes-app#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! /Users/jonosuave/.npm/_logs/2019-11-07T01_56_26_260Z-debug.log
In experimental node, Babel isn't even required -- just need to use a .mjs extension to files instead of .js
See explanation with example: How can I use an es6 import in node?

Using NPM for SCSS but the script will not watch for changes. It gives me a error

I have installed Node v12.10.0, NPM v6.10.3. I have also tried to install the node LTS version as well.
I built my project directory and inside the directory I ran "npm init" and after I ran "npm install --save-dev node-sass". Everything seems good up to this point.
my package.json file looks like this
{
"name": "dashboard",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"scss": "node-sass --watch scss -o css"
},
"author": "",
"license": "ISC",
"devDependencies": {
"node-sass": "^4.12.0"
}
}
After I go to run " npm run scss" then I receive this.
> dashboard#1.0.0 scss /Users/adakaitalker/Documents/school/dev/learning/2-september/4-week/9:13:19/dashboard
> node-sass --watch scss -o css
sh: node-sass: command not found
npm ERR! code ELIFECYCLE
npm ERR! syscall spawn
npm ERR! file sh
npm ERR! errno ENOENT
npm ERR! dashboard#1.0.0 scss: `node-sass --watch scss -o css`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the dashboard#1.0.0 scss 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/adakaitalker/.npm/_logs/2019-09-13T22_43_56_711Z-debug.log
figured it out. I installed homebrew and linked it to node then I used homebrew to uninstall it and reinstall it and it works now.

Use dependencies from a private GitLab with NPM

I'm trying to install NPM dependencies from a private GitLab instence.
So, I have my repo with basic files
And I added this dependencie in the package.json on my project
"node-demo-package": "https://oauth2:<ACCESS TOKEN>#gitlab.fullurl.git"
But, when I run npm install, I receive this error message:
npm ERR! code ENOPACKAGEJSON
npm ERR! package.json Non-registry package missing package.json: node-demo-package#https://oauth2:<ACCESS TOKEN>#gitlab.fullurl.git.
npm ERR! package.json npm can't find a package.json file in your current directory.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/arnaud.delante/.npm/_logs/2018-01-24T15_05_49_456Z-debug.log
Which I don't understand as there is a package.json as showed in the screenshot.
Here it is
{
"name": "demo-package",
"version": "1.0.0",
"description": "Test pasckage",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"repository": {
"type": "git",
"url": "git#gitlab.fullurl.git"
},
"author": "Arnaud Delante",
"license": "MIT"
}
I already tried switching https by git+https but I get another error
npm ERR! Error while executing:
npm ERR! /usr/local/bin/git ls-remote -h -t https://oauth2:<ACCES TOKEN>#gitlab.fullrul.git
npm ERR!
npm ERR! remote: You are not allowed to download code from this project.
npm ERR! fatal: unable to access 'https://oauth2:<ACCES TOKEN>#gitlab.fullrul.git': The requested URL returned error: 403
npm ERR!
npm ERR! exited with error code: 128
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/arnaud.delante/.npm/_logs/2018-01-24T17_19_16_677Z-debug.log
Which is weird because the token is correct.
Would you have any idea?
In package.json try to replace https:// by git+https://
doc : https://docs.npmjs.com/files/package.json#git-urls-as-dependencies

Resources