published an npm package but installing it just has bare bones files - javascript

so I have published an npm package but when I installed it, it didn't pull any of the code from my github repo. Instead, it just has the node_modules
{
"name": "asdf",
"version": "1.0.3",
"description": "asdf",
"main": "index.js",
"dependencies": {
"got": "^9.6.0"
},
"devDependencies": {},
"scripts": {
"start": "node index.js"
},
"bin" : { "asdf" : "index.js" },
"files": [
"index.js"
],
"repository": {
"type": "git",
"url": "git+https://github.com/asdf/asdf.git"
},
"author": "",
"license": "ISC",
"bugs": {
"url": "https://github.com/asdf/asdf/issues"
},
"homepage": "https://asdf"
}
What I expected was to have the index.js it pulls from git repo which is public.

Related

jsdoc error ENOENT: no such file or directory, open './readme/readme.md'

I have already installed jsdoc with npm i -D jsdoc command and created jsdoc.json file. In package.json file there is script called doc and after doing npm run doc jsdoc throws an error Error: ENOENT: no such file or directory, open './readme/readme.md'
package.json
{
"name": "alphabetdb",
"version": "1.0.0",
"description": "",
"main": "index.js",
"type": "module",
"scripts": {
"start": "node index.js",
"doc": "jsdoc -c jsdoc.json"
},
"keywords": [],
"author": "",
"license": "ISC",
"devDependencies": {
"jsdoc": "^3.6.10"
}
}
jsdoc.json
{
"source": {
"include": ["src"],
"includePattern": ".js$",
"excludePattern": "(node_modules/|docs)"
},
"plugins": ["plugins/markdown"],
"templates": {
"cleverLinks": true,
"monospaceLinks": true
},
"opts": {
"recurse": true,
"destination": "./docs/",
"template": "./custom-template",
"tutorials": "./tutorials",
"readme": "./readme/readme.md"
}
}
file tree
node_modules/
src/
fileSystem.js
index.js
jsdoc.js
package-lock.json
package.json
You have to remove the "readme": "./readme/readme.md". Seems like this is an outdated parameter, as it is also not mentioned in the docs.

Linux electron npm give me install-app-deps: not found

I'm trying to make my electron app work on linux. It's working fine on Windows.
When I'm trying a 'npm ci', I get the following error :
sh: 1: install-app-deps: not found
I haven't found anything usefull on google. I guess it could be my electron-forge who can be this trouble source, but I don't know any turn around for it.
My Package.json :
{
"name": "roseplayer",
"version": "0.0.2",
"description": "A webradio player",
"main": "main.js",
"scripts": {
"run": "electron .",
"test": "jest",
"postinstall": "install-app-deps",
"start": "electron-forge start",
"package": "electron-forge package",
"make": "electron-forge make"
},
"author": "Khan From Chedum",
"license": "ISC",
"dependencies": {
"electron-squirrel-startup": "^1.0.0",
"node-internet-radio": "^0.2.1",
"radio-browser": "^2.1.7",
"sqlite3": "^5.0.2"
},
"devDependencies": {
"#electron-forge/cli": "^6.0.0-beta.57",
"#electron-forge/maker-deb": "^6.0.0-beta.57",
"#electron-forge/maker-rpm": "^6.0.0-beta.57",
"#electron-forge/maker-squirrel": "^6.0.0-beta.57",
"#electron-forge/maker-zip": "^6.0.0-beta.57",
"electron": "^12.0.10"
},
"config": {
"forge": {
"packagerConfig": {
"icon": "./img/outline_filter_vintage_black_48dp.ico"
},
"makers": [
{
"name": "#electron-forge/maker-squirrel",
"config": {
"name": "roseplayer"
}
},
{
"name": "#electron-forge/maker-zip",
"platforms": [
"darwin"
]
},
{
"name": "#electron-forge/maker-deb",
"config": {}
},
{
"name": "#electron-forge/maker-rpm",
"config": {}
}
]
}
}
}
My github : link
Thank you
I've found my mistake:
I'm using electron-forge and therefore I can't use npm install nor npm ci.
For more information, in case you're interested, you can go to the electron-forge home page.

Netlify: Failed to upload file: &{Name:submission-created during build

I'm trying to use netlify and its lambda function feature to run a node function. Based on https://css-tricks.com/using-netlify-forms-and-netlify-functions-to-build-an-email-sign-up-widget/.
I'm having trouble getting node modules to work (see ImportModuleError","errorMessage":"Error: Cannot find module while using Netlify lambda functions with dependencies)
Currently my netlify.toml has only the following:
[build]
functions = "./functions"
command = "npm run-script build"
and my package.json:
{
"name": "test2",
"version": "1.0.0",
"description": "",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"build": "npm install && npm build"
},
"repository": {
"type": "git",
"url": "git+https://github.com/kc1/test2.git"
},
"keywords": [],
"author": "",
"license": "ISC",
"bugs": {
"url": "https://github.com/kc1/test2/issues"
},
"homepage": "https://github.com/kc1/test2#readme",
"dependencies": {
"dotenv": "^8.2.0",
"node-fetch": "^2.6.1"
}
}
You can see the deploy log here: https://app.netlify.com/sites/inspiring-ardinghelli-4a4da5/deploys/5fd180d4db83b400073f8694. What am I doing wrong?

Why do I have SyntaxError: Cannot use import statement outside a module?

I am trying to run mockingoose example
> alonjest#1.0.0 test /home/milenko/pract/alonjest
> jest __tests__
FAIL .history/__tests__/user.test_20201028132815.js
● Test suite failed to run
Details:
/home/milenko/pract/alonjest/.history/__tests__/user.test_20201028132815.js:1
({"Object.<anonymous>":function(module,exports,require,__dirname,__filename,global,jest){import mockingoose from 'mockingoose';
Package.json
"name": "alonjest",
"version": "1.0.0",
"description": "",
"main": "user.js",
"type": "module",
"scripts": {
"test": "jest __tests__"
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"mongoose": "^5.10.11"
},
"devDependencies": {
"jest": "^26.6.1",
"mockingoose": "^2.13.2"
}
}
Dir structure
node_modules
package.json
package-lock.json
__tests__
user.mjs
What is wrong with my configuration?

How do you run multiple grunt scripts.postinstall?

I'm trying to run multiple CLI commands from scripts.postinstall of grunt. I can't figure out how to get both to run. If I add the second command neither run. Separately they both work on postinstall and in the console.
I've tried wrapping them in an array:
"scripts": {
"postinstall": ["node_modules/.bin/bower install", "grunt setup"]
},
I tried separating them with a semi-colon:
"scripts": {
"postinstall": "node_modules/.bin/bower install; grunt setup"
},
I can't seem to find the solution on NPM Scripts
My gruntfile.js for these sections look like this:
mkdir: {
setup: {
options: {
create: [
'app/main/source/www', 'app/main/build', 'app/main/docs', 'app/main/tests',
'app/development',
'app/releases'
]
}
}
}
grunt.registerTask('setup', [
'mkdir:setup',
'bowercopy:wordpress'
]);
In case it helps here's a parred down version of my package.json that I snipped the above code examples, mostly to provide context.
{
"name": "webapp",
"version": "0.1.0",
"description": "A web app using bower and grunt",
"main": "gruntfile.js",
"scripts": {
"postinstall": "node_modules/.bin/bower install"
},
"repository": {
"type": "git",
"url": "someurl.com"
},
"keywords": [
"web", "app"
],
"author": {
"company": "somecompany",
"name": "somename",
"email": "email#me.com"
},
"license": "MIT",
"homepage": "https://someurl.com",
"bugs": {
"url": "someurl.com"
},
"devDependencies": {
"grunt": "^0.4.5",
"bower" : "~1.3.5",
etc
}
}
You can use && to run multiple commands in the npm scripts section
"scripts": {
"postinstall": "bower install && grunt setup"
},
You could try writing a Bash script that executes those two commands and run that instead.
post_install.sh:
#!/bin/bash
node_modules/.bin/bower install
grunt setup
package.json:
"scripts": {
"postinstall": "./post_install.sh"
},

Categories