npm install failing. Cloud 9 ide - node.js

I am having the same issue with npm. Tried on my pc tried to avoid directory issues and getting the same issues on cloud9 . Hoping it being on a virtual machine there would be little i could do to mess it up, i have tried private:true and falsi and completely without it. As well as sockt.io "latest" same with express. Any insight would be great
{ "name": "chit",
"version": "0.0.1",
"description": "chat practice",
"private": "false",
"dependencies":{ "socket.io":"1.4.8",
"express":"4.14.0" }
"author": "Charles",
"license": "ISC"
Thank you so much
See error
ERR! install Couldn't read dependencies
npm ERR! Linux 4.2.0-c9
npm ERR! argv "/home/ubuntu/.nvm/versions/node/v4.4.5/bin/node" "/home/ubuntu/.nvm/versions/node/v4.4.5/bin/npm" "install"
npm ERR! node v4.4.5
npm ERR! npm v2.15.5
npm ERR! file /home/ubuntu/workspace/chat/package.json
npm ERR! code EJSONPARSE
npm ERR! Failed to parse json
npm ERR! Unexpected token 'a' at 10:4
npm ERR! "author": "Charles",
npm ERR! ^
npm ERR! File: /home/ubuntu/workspace/chat/package.json
npm ERR! Failed to parse package.json data.
npm ERR! package.json must be actual JSON, not just JavaScript.
npm ERR!
npm ERR! This is not a bug in npm.
npm ERR! Tell the package author to fix their package.json file. JSON.parse
npm ERR! Please include the following file with any support request:
npm ERR! /home/ubuntu/workspace/chat/npm-debug.log

You're missing a colon here:
{ "name": "chit",
"version": "0.0.1",
"description": "chat practice",
"private": "false",
"dependencies":{ "socket.io":"1.4.8",
"express":"4.14.0" } // <--- missing colon here
"author": "Charles",
"license": "ISC"
It should be:
{
"name": "chit",
"version": "0.0.1",
"description": "chat practice",
"private": "false",
"dependencies": {
"socket.io": "1.4.8",
"express": "4.14.0"
},
"author": "Charles",
"license": "ISC"
}

Related

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

Publish npm, and after installation on other PC have error

and then install it on other pc to check. Bu after install package and it depencies i have error when try to start it
pm ERR! Linux 4.10.0-38-generic
npm ERR! argv "/home/pavlo/.nvm/versions/node/v6.11.4/bin/node" "/home/pavlo/.nvm/versions/node/v6.11.4/bin/npm" "start" "storjboard"
npm ERR! node v6.11.4
npm ERR! npm v3.10.10
npm ERR! path /home/pavlo/Desktop/test/package.json
npm ERR! code ENOENT
npm ERR! errno -2
npm ERR! syscall open
npm ERR! enoent ENOENT: no such file or directory, open '/home/pavlo/Desktop/test/package.json'
npm ERR! enoent ENOENT: no such file or directory, open '/home/pavlo/Desktop/test/package.json'
npm ERR! enoent This is most likely not a problem with npm itself
npm ERR! enoent and is related to npm not being able to find a file.
npm ERR! enoent
npm ERR! Please include the following file with any support request:
npm ERR! /home/pavlo/Desktop/test/npm-debug.log
Problem it that i have to clone package.json from git , how i can publish correctly with package.json?
Note: command start inside package.json scripts
My json for publish:
{
"name": "name",
"version": "0.0.3",
"description": "Name",
"main": "script.js",
"dependencies": {
"request": "^2.83.0",
},
"devDependencies": {},
"scripts": {
"test": "mocha",
"start": "node node_modules/module/script.js"
},
"repository": {
"type": "git",
"url": "https://github.com/me/module"
},
"keywords": [
"somewords"
],
"author": "me",
"license": "MIT",
"bugs": {
"url": "https://github.com/me/module/issues"
},
"homepage": "https://github.com/me/module#readme"
}
Error (WARN) when installing module on other PC
npm WARN enoent ENOENT: no such file or directory, open '/home/pavlo/Desktop/test/package.json'
npm WARN test No description
npm WARN test No repository field.
npm WARN test No README data
npm WARN test No license field.
But in test/node_modules/module/(here there are everything) readme, json and script
If you want to be able to start your module from another directory, you can do it like this:
In your module package.json
{
"name": "module",
"scripts": {
"start": "node script.js"
}
}
from the test directory (as this answer suggest):
npm start --prefix node_modules/module/
Alternately, you can start your module by creating a package.json file in your test directory and adding a script:
{
"name": "test",
"scripts": {
"start": "node node_modules/module/script.js"
}
}
Usally npm packages are placed in node_modules directory because those modules are supposed to be used as dependencies, not directly.
It depends on the purpose of your application, but maybe you might be interested in doing a post-install script or installing it globally.
npm doc for packages installation.

why I am unable to publish my package to npmjs

I have created an account with npmjs.com also I'm following the how-to-npm tutorial from command line (linux). I'm at the stage where I should publish my test module. But I keep getting error:
You must sign up for private packages : #zentech/node
these are all the error when npm publish
npm ERR! publish Failed PUT 402
npm ERR! Linux 4.10.0-33-generic
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "publish"
npm ERR! node v4.7.2
npm ERR! npm v3.5.2
npm ERR! code E402
npm ERR! You must sign up for private packages : #zentech/node
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR! <https://github.com/npm/npm/issues>
npm ERR! Please include the following file with any support request:
npm ERR! /home/george/node/npm-debug.log
my package.json file
{
"name": "#zentech/node",
"version": "1.0.1",
"main": "index.js",
"preferGlobal": true,
"scripts": {
"test": "node test.js"
},
"author": "",
"license": "ISC",
"description": "",
"repository": "http://github.com/zentech/node"
}
does anyone know why the error? thanks
As suggested in the comments above the way to publish a scoped package i.e.
#scope/my-package
is to use the --access flag when publishing
npm publish --access=public
You do not need to sign up for private packages unless you actually want your package to be private.
Or you can set the public access on package.json:
{
...
"publishConfig": {"access": "public"}
...
}
rather than:
{
...
"publishConfig": {"access": "restricted"}
...
}
You must sign up for private packages: #zentech/node
So you either sign up, or you change the name of your package from #zentech/node to a public name, like zentech-node.

npm install Giving error when Moving Project to Another Directory

I have a node project running in a directory, and I simply want to move it to another directory, let's say. When I try that, of course without the node_modules folder, and try to run npm install; it gives this error:
npm ERR! addLocal Could not install /Users/me_here
npm ERR! Darwin 15.3.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install"
npm ERR! node v5.8.0
npm ERR! npm v3.7.3
npm ERR! No version provided in package.json
My package.json is as follows:
{
"name": "my-amazing-title",
"version": "1.0.0",
"description": "an amazing description",
"main": "app.js",
"scripts": {
"start": "node app.js"
},
"author": "My full name",
"license": "MIT",
"dependencies": {
"express": "3.3.5",
"express-react-views": "file:../../",
"js-md5": "^0.4.0",
"react": "^0.14.0",
"react-dom": "^0.14.0",
"request": "^2.69.0",
"webpack": "^1.12.14"
}
}
I was able to npm install with your package.json by changing this line:
"express-react-views": "file:../../",
to
"express-react-views": "~0.10.0", //the current version at date of posting

node.js version issue or something else

I have
"node":"0.10.12",
"npm":"1.2.30"
in my package and i have installed
node 0.10.26
and
npm 1.4.7
and having an
error Failed at the Kiwi-Move-API#0.0.1 start script.
npm ERR! This is most likely a problem with the Kiwi-Move-API package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node server.js
npm ERR! You can get their info via:
npm ERR! npm owner ls Kiwi-Move-API
npm ERR! There is likely additional logging output above.
npm ERR! System Linux 3.8.0-35-generic
npm ERR! command "node" "/usr/local/bin/npm" "start"
npm ERR! cwd /home/asnadatta/work/kiwi/kiwi-devkit
npm ERR! node -v v0.10.26
npm ERR! npm -v 1.4.7
npm ERR! code ELIFECYCLE
this is my complete package
{
"name": "Kiwi-Move-API",
"version": "0.0.1",
"description": "Kiwi Move Webservices API",
"main": "server.js",
"engines": {
"node":"0.10.12",
"npm":"1.2.30"
},
"dependencies": {
"express": "~3.3.4",
"mongoose": "~3.6.14",
"mongo": "~0.1.0",
"redis": "~0.8.4",
"ws": "~0.4.27",
"mocha": "~1.12.0",
"bcrypt": "0.7.6",
"node-oauth2-server":"1.5.0",
"underscore":"1.5.1",
"nodemailer":"0.5.2",
"should":"1.2.2",
"request":"2.25.0",
"nano": "~4.1.4"
},
"devDependencies": {},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "node server.js"
},
"keywords": [
"Kiwi",
"Move",
"Kiwi",
"Wearable",
"Tech"
],
"author": "Mike Holmes",
"license": "BSD"
}
Is this versions issue or some thing else

Resources