79636

npm node enconding

Question:

I want to npm install the following validate .json

{ "name": "node-todo", "version": "0.0.0", "description": "Simple todo application", "main": "server.js", "dependencies": { "express": "~3.4.4", "mongoose": "~3.6.2" }, "private": true }

but the npm install doesn't seem to work because I even cant npm install a sample json from <a href="http://package-json-validator.com/" rel="nofollow">http://package-json-validator.com/</a>

I installed npm and nodejs with the following commands

echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc . ~/.bashrc mkdir ~/local mkdir ~/node-latest-install cd ~/node-latest-install curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1 ./configure --prefix=~/local make install # ok, fine, this step probably takes more than 30 seconds... curl https://npmjs.org/install.sh | sh

Now I want to use npm install but the shell gives me this npm ERR! install Couldn't read dependencies npm ERR! Failed to parse json npm ERR! Unexpected token / 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! System Darwin 13.0.0 npm ERR! node -v v0.10.22 npm ERR! npm -v 1.3.14 npm ERR! code EJSONPARSE npm ERR! npm ERR! Additional logging details can be found in: npm ERR! not ok code 0

I'm using Sublime and saved the json as a UTF-8 (without the BOM tag)

Answer1:

Assuming you are running ubuntu or that you are using the aptitude package manager

apt-get install -y python-software-properties python g++ make add-apt-repository ppa:chris-lea/node.js apt-get install nodejs apt-get install npm

Then run this when needed to update the sources.list and install the latest version.

apt-get update apt-get upgrade nodejs

If you want to downgrade node simply use

apt-get install nodejs={version number}

Answer2:

<strong>Linux Installation - node.js</strong>:

<ul><li>

Via package manager for many distros:<br /><a href="https://github.com/joyent/node/wiki/Installing-Node.js-via-package-manager" rel="nofollow">https://github.com/joyent/node/wiki/Installing-Node.js-via-package-manager</a>

Or

</li> <li>

Via download binaries (this worked for me after many problems with other solutions)

a) download from <a href="https://nodejs.org/download/release/latest/" rel="nofollow">https://nodejs.org/download/release/latest/</a><br /> b) move to /usr/local/

Note: To avoid permissions problems when install none modules globally (npm install -g ...) you must to move files preserving your ownership.

<blockquote>

i) Unpack as normal user, ie, <strong>not sudo</strong>:<br /> tar -zxvf node-package.tar.gz

ii) Move properly (-p same as -<strong>preserve</strong>=mode,ownership,timestamps):<br /> sudo cp -rp node-package/* /usr/local/ && rm -rf node-package

</blockquote></li> </ul>

<img alt="enter image description here" class="b-lazy" data-src="https://i.stack.imgur.com/knvjn.png" data-original="https://i.stack.imgur.com/knvjn.png" src="https://etrip.eimg.top/images/2019/05/07/timg.gif" />

<strong>Linux Installation - npm</strong>

<ul><li>

Be sure you have node.js already installed (node -v):

<blockquote>

curl <a href="https://www.npmjs.org/install.sh" rel="nofollow">https://www.npmjs.org/install.sh</a> | sh

Note: <em>www.npmjs.org/install.sh</em> is the new URL after February 2014

</blockquote></li> </ul>

Recommend

  • Access Windows shortcuts (.lnk) data on Node
  • NPM view most recent *stable* version of a package
  • Parse Server - How to use a scheduler to run 'jobs' over and over
  • Running NPM mapbox-map-image-export
  • Node.js How to convert to image from varbinary of MS Sql server datatype
  • Angular 6 Uncaught ReferenceError: Buffer is not defined
  • Recursive extraction of object values and parent key name using jq
  • How to delete an npm package from the npm registry?
  • Protecting API URL Data from being seen. cURL?
  • ngImgCrop Dependency Injection not working properly in AngularJs
  • Deploying a NodeJS App to Azure Websites fails on installing NPM packages from pagages.json from dep
  • Unable to communicate to device with .local domain using android, corova-zeroconf-plugin
  • Update vsts-npm-auth with new username and password
  • Angular CLI - Set Up production proxy for now deploying
  • Why does _GET in PHP wrongly decodes slash?
  • How do I get the post request with express js?
  • Building jamvm 1.5.4 on OS X Lion
  • How to implement Deep Linking in Roku SG application?
  • How can I get the full list of running processes on a Mac from a python app
  • Azure webjobs output logs indexing taking very long
  • Debugging VB6 Code From Visual Studio 2010
  • bad substitution shell- trying to use variable as name of array
  • Diff between two dataframes in pandas
  • ADO and msqli connections very slow
  • Marklogic : Query response time is very high
  • print() is showing quotation marks in results
  • How to use remove-erase idiom for removing empty vectors in a vector?
  • MailKit: The IMAP server replied to the 'EXAMINE' command with a 'BAD' response
  • Spark fat jar to run multiple versions on YARN
  • Q promise. Difference between .when and .then
  • Illegal mix of collations for operation for date/time comparison
  • Sony Xperia Z Tablet not found by adb
  • How to recover from a Spring Social ExpiredAuthorizationException
  • How to add a column to a Pandas dataframe made of arrays of the n-preceding values of another column
  • How can I estimate amount of memory left with calling System.gc()?
  • retrieve vertices with no linked edge in arangodb
  • Revoking OAuth Access Token Results in 404 Not Found
  • Hits per day in Google Big Query
  • need help with bizarre java.net.HttpURLConnection behavior
  • XCode 8, some methods disappeared ? ex: layoutAttributesClass() -> AnyClass