When I'm trying to install express with npm I always get the following error:
Failed to parse json No data, empty input at 1:1 File: /root/.npm/inherits/2.0.1/package/package.json Failed to parse package.json data. package.json must be actual JSON, not just JavaScript. This is not a bug in npm. Tell the package author to fix their package.json file. JSON.parse
What am I doing wrong?
sudo npm install -g express
OS is Ubuntu 12.04 (precise) armhf
parse: unexpected character" error occurs when passing a value that is not a valid JSON string to the JSON. parse method, e.g. a native JavaScript object. To solve the error, make sure to only pass valid JSON strings to the JSON.
The npm install installs all modules that are listed on package. json file and their dependencies. npm update updates all packages in the node_modules directory and their dependencies.
The essence of the JSON modules proposal is to allow importing JSON data inside of an ES module using a regular import statement. import jsonObject from "./file. json" assert { type: "json" }; assert { type: "json" } is an import assertion indicating the module should be parsed and imported as JSON.
Thanks to Jivings from this comment:
npm cache clean
solved the problem.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With