Warning on node showing wrong node version. Could it cause sqlite3 Error? - node.js

When running npm install I get the warning message:
npm WARN engine module#0.0.1: wanted: {"node":">= 0.2.9 < 0.7.0"} (current: {"node":"0.12.2","npm":"2.7.4"})
But in the package.json is specified node 5.3.0 (pls. see below)
Why does the message tell me the version 0.12 when the current version is 5.3?
Could it be the case for the error with sqlite3? I get the message:
Error: Cannot find module '...\node-v47-win32-x64\node_sqlite3.node'
at Function.Module._resolveFilename (module.js:326:15)
But in fact npm intall creates me node-v14-win32-x64 not node-v47-win32-x64 directory.
{
"name": "aesku-hera",
"version": "0.0.0",
"private": true,
"scripts": {
"start": "supervisor ./bin/www"
},
"engines": {
"node": "5.3.0",
"npm": "2.7.4"
},
"dependencies": {
"body-parser": "^1.12.4",
"connect-busboy": "0.0.2",
"cookie-parser": "~1.3.5",
"debug": "~2.2.0",
"execsql": "0.0.3",
"express": "~4.12.4",
"gm": "^1.18.1",
"jade": "^1.9.2",
"jsonfile": "^2.2.3",
"module": "0.0.1",
"moment": "^2.10.3",
"morgan": "~1.5.3",
"multer": "0.1.6",
"node-hl7": "^0.1.3",
"node-json-db": "^0.6.3",
"node-mv": "^0.1.3",
"periodic-task": "^0.1.0",
"pg": "^4.4.0",
"request": "^2.58.0",
"serve-favicon": "~2.2.1",
"sqlite3": "^3.1.1",
"string": "^3.3.0"
}
}

The engines section in your package.json is just an indicator of which engine (like node) and the version your code would work on - see the documentation for more details.
It is most likely that your locally installed Node is version 0.12. You should upgrade it to 5.3.0 or higher and then try reinstalling your packages.
You can quickly verify your Node version by using the command -
node -v

Related

How to fix: The feature watch recursively is unavailable on the current platform, which is being used to run Node.js

I am trying to run a typescript express.js in a docker container. After running the docker I get the following error:
> ts-node-dev src/app.ts
Using ts-node version 8.10.1, typescript version 3.9.2
TypeError [ERR_FEATURE_UNAVAILABLE_ON_PLATFORM]: The feature watch recursively is unavailable on the current platform, which is being used to run Node.js
at Object.watch (fs.js:1441:11)
at add (/app/node_modules/filewatcher/index.js:74:34)
at /app/node_modules/filewatcher/index.js:93:5
at FSReqCallback.oncomplete (fs.js:176:5)
my Dockerfile:
FROM node:alpine
WORKDIR /app
COPY package.json .
RUN npm install
COPY . .
CMD ["npm","start"]
and the package.json file:
{
"name": "app-name",
"version": "1.0.0",
"description": "Init master",
"main": "src/app.ts",
"scripts": {
"build": "./node_modules/.bin/tsc",
"start": "ts-node-dev src/app.ts"
},
"repository": {
"type": "git",
"url": "https://*****#dev.azure.com/********"
},
"author": "",
"license": "ISC",
"dependencies": {
"celebrate": "^12.1.1",
"colors": "^1.4.0",
"cors": "^2.8.5",
"dotenv": "^8.2.0",
"event-dispatch": "^0.4.1",
"eventemitter3": "^4.0.0",
"express": "^4.17.1",
"helmet": "^3.22.0",
"jsonwebtoken": "^8.5.1",
"moment": "^2.25.3",
"mongoose": "^5.9.13",
"morgan": "^1.10.0",
"ms": "^2.1.2",
"pbkdf2": "^3.0.17",
"redis": "^3.0.2",
"reflect-metadata": "^0.1.13",
"status-code-enum": "^1.0.0",
"swagger-jsdoc": "^4.0.0",
"swagger-ui-express": "^4.1.4",
"ts-node": "^8.10.1",
"typedi": "^0.8.0",
"uuid": "^8.0.0",
"winston": "^3.2.1"
},
"devDependencies": {
"#types/express": "^4.17.6",
"#types/mongoose": "^5.7.16",
"#types/node": "^13.13.5",
"ts-node-dev": "^1.0.0-pre.44",
"typescript": "^3.8.3"
}
}
P.S. I have decided to include the fix:
change the Dockerfile:
FROM node:lts-alpine
and change the package.json:
"start": "ts-node-dev src/app.ts --poll"
Node v14 introduced a breaking change to the fs.watch() API, specifically that the recursive option (which has never been supported on Linux) now raises the ERR_FEATURE_UNAVAILABLE_ON_PLATFORM error if used on Linux.
A bug report and fix have been submitted to filewatcher: https://github.com/fgnass/filewatcher/pull/6
Until that fix is merged and a new version released, you'll need to stick to NodeJS < v14, or override the filewatcher package installed locally to include that patch.
It seems this error caused by node.js v14, to fix it use this command:
ts-node-dev --poll src/app.ts
Or you can use another version of node.js rather than version 14

Segmentation 11 Error in Node Sass when running a Gulp Task

I've been battling with this issue for the past few hours now and all of the fixes I've found online have unfortunately not worked for me.
When running a gulp task, such as gulp deploy (I'm developing for Netsuite) the task will run until compiling SASS and then I get this error:
/Users/chrismartyr/Documents/GitHub/ChannelTen/node_modules/amd-optimize/lib/parse.js:14
return a.value;
^
TypeError: Cannot read property 'value' of null
at /Users/chrismartyr/Documents/GitHub/ChannelTen/node_modules/amd-optimize/lib/parse.js:14:15
at Array.map (native)
at valuesFromArrayExpression (/Users/chrismartyr/Documents/GitHub/ChannelTen/node_modules/amd-optimize/lib/parse.js:13:26)
at walk.ancestor.CallExpression (/Users/chrismartyr/Documents/GitHub/ChannelTen/node_modules/amd-optimize/lib/parse.js:77:22)
at c (/Users/chrismartyr/Documents/GitHub/ChannelTen/node_modules/amd-optimize/node_modules/acorn/util/walk.js:47:18)
at Object.skipThrough (/Users/chrismartyr/Documents/GitHub/ChannelTen/node_modules/amd-optimize/node_modules/acorn/util/walk.js:163:39)
at c (/Users/chrismartyr/Documents/GitHub/ChannelTen/node_modules/amd-optimize/node_modules/acorn/util/walk.js:46:17)
at Object.base.ExpressionStatement (/Users/chrismartyr/Documents/GitHub/ChannelTen/node_modules/amd-optimize/node_modules/acorn/util/walk.js:176:5)
at c (/Users/chrismartyr/Documents/GitHub/ChannelTen/node_modules/amd-optimize/node_modules/acorn/util/walk.js:46:17)
at Object.skipThrough (/Users/chrismartyr/Documents/GitHub/ChannelTen/node_modules/amd-optimize/node_modules/acorn/util/walk.js:163:39)
Segmentation fault: 11
I've tried removing and re installing the node modules, I've also tried different versions of node, unfortunately I have to use between 4.0.0 - LTS as if defined by the version of Suitecommerce Advanced I'm using.
I'm currently using node 4.9.1 and npm 2.15.11.
Watch tasks run fine, it's only when it's compiling the SCSS for production that this error occurs..
Heres the package.json:
{
"name": "suitecommerce-builder",
"version": "0.0.1",
"description": "Sets of tasks to build a Reference Implementation",
"main": "gulpfile.js",
"private": true,
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"author": "",
"license": "ISC",
"dependencies": {
"amd-optimize": "0.3.1",
"archiver": "0.13.0",
"async": "0.9.0",
"cli-spinner": "0.1.5",
"del": "0.1.1",
"escodegen": "1.6.1",
"esprima": "1.2.5",
"estraverse": "1.9.3",
"express": "4.13.3",
"glob": "4.0.4",
"gulp": "3.8.7",
"gulp-add": "0.0.2",
"gulp-bless": "3.0.1",
"gulp-changed": "1.0.0",
"gulp-concat": "2.3.3",
"gulp-cssfmt": "^1.0.0",
"gulp-handlebars": "3.0.1",
"gulp-if": "1.2.5",
"gulp-insert": "0.4.0",
"gulp-jshint": "1.9.0",
"gulp-jst": "0.1.1",
"gulp-less": "1.3.6",
"gulp-livereload": "2.1.1",
"gulp-minify-css": "0.3.13",
"gulp-sass": "2.1.0",
"gulp-sourcemaps": "1.2.8",
"gulp-svg2ttf": "1.0.3",
"gulp-ttf2eot": "1.0.1",
"gulp-ttf2woff": "1.0.1",
"gulp-uglify": "0.3.1",
"gulp-util": "3.0.1",
"handlebars": "2.0.0",
"inquirer": "0.5.1",
"is-my-json-valid": "2.13.1",
"jshint-stylish": "1.0.0",
"jsonlint": "1.6.2",
"jsonpath-plus": "0.15.0",
"lazypipe": "0.2.2",
"lodash": "2.4.1",
"map-stream": "0.1.0",
"mime": "1.2.11",
"moment": "2.8.3",
"node-sass": "3.4.1",
"ns-uploader": "file:./ns_npm_repository/ns-uploader",
"progress": "1.1.7",
"q": "1.0.1",
"request": "2.39.0",
"serve-index": "1.7.2",
"shelljs": "^0.5.3",
"short-jsdoc": "0.2.4",
"sourcemap-to-ast": "0.0.2",
"through": "2.3.6",
"through2": "0.6.3",
"underscore": "1.6.0",
"vinyl": "0.4.6",
"xml2js": "0.4.5",
"yargs": "1.3.1",
"credentials-inquirer": "file:./ns_npm_repository/credentials-inquirer",
"suitetalk": "file:./ns_npm_repository/suitetalk4node",
"preconditions": "file:./ns_npm_repository/preconditions",
"xmlbuilder": "8.2.2"
},
"optionalDependencies": {
"minijasminenode2": "1.0.0",
"gulp-jasmine-phantom": "1.1.2",
"fsevents": "0.3.7"
}
}
Any help would be very much appreciated?
Thanks!
I would recommend updating package.json's entry for amd-optimizer. The latest version as shown on https://www.npmjs.com/package/gulp-amd-optimizer is 0.6.0.
And as per https://docs.npmjs.com/cli/update, I'd recommend using the npm update command:
npm update amd-optimizer
You may need to specify the package version, in which case it will be amd-optimizer#0.6.0
Note, npm update also updates the package.json file according to the docs page.
You may need to be in the node_modules directory when running this command.
Hope this helps,

NativeBase setup/installation error

I am trying to setup/install Native-Base in my React-Native project using the official document. But getting error every time.
Command: npm install native-base --save
Error:
npm ERR! Unexpected end of JSON input while parsing near '...yish/-/is-arrayish-0.'
npm ERR! A complete log of this run can be found in:
npm ERR! /home/abhijitsrivastava/.npm/_logs/2018-07-04T06_03_24_057Z-debug.log
System Specification:
node --version
v8.1.0
npm --version
6.0.0
react-native --version
react-native-cli: 2.0.1
react-native: 0.55.4
Machine: Ubuntu 16.04LTS
IDE: Visual Studio Code Version 1.23.0
As per the compatibility matrix every thing is looking OK. I don't know how can I fix it.
Update :
Here is my package.json file.
{
"name": "xyz",
"version": "0.0.1",
"private": true,
"scripts": {
"start": "node node_modules/react-native/local-cli/cli.js start",
"test": "jest"
},
"dependencies": {
"react": "16.3.1",
"react-native": "^0.55.4",
"react-navigation": "^2.3.1",
"redux": "^4.0.0"
},
"devDependencies": {
"babel-jest": "23.0.1",
"babel-preset-react-native": "4.0.0",
"jest": "23.1.0",
"react-test-renderer": "16.3.1"
},
"jest": {
"preset": "react-native"
}
}
I have noticed in a recent forum post where they've recommeneded to use yarn in place of npm for installing the dependencies and for creating the react native app.
Yarn: https://yarnpkg.com/en/docs/install#windows-stable
After installing yarn try issuing the below command,
yarn add native-base --save
Hope this helps!
Tried on same lines, no issues
{
"name": "NativebaseKitchenSink",
"version": "2.5.2",
"private": true,
"devDependencies": {
"babel-eslint": "7.2.3",
"eslint": "4.4.1",
"eslint-plugin-flowtype": "2.35.0",
"eslint-plugin-import": "2.7.0",
"eslint-plugin-jsx-a11y": "6.0.2",
"eslint-plugin-prettier": "2.1.2",
"eslint-plugin-react": "7.1.0",
"eslint-plugin-react-native": "3.0.1",
"flow-bin": "0.52.0",
"flow-typed": "2.1.5",
"husky": "0.14.3",
"jest": "20.0.4",
"jest-expo": "25.0.0",
"prettier": "1.5.3",
"react-test-renderer": "16.3.1"
},
"scripts": {
"start": "react-native start",
"android": "react-native run-android",
"ios": "react-native run-ios",
"test": "node node_modules/jest/bin/jest.js --watch"
},
"jest": {
"preset": "react-native"
},
"dependencies": {
"color": "1.0.3",
"lodash": "4.13.1",
"moment": "2.13.0",
"native-base": "^2.6.1",
"react": "16.3.1",
"react-native": "0.55.4",
"react-navigation": "1.5.0"
}
}
To solve this issue you can try to change your node js version
npm install native-base this is giving issue with 18.7.0 version but
change to
version 16.16.0 LTS for this it is working properly
https://nodejs.org/en/

how to have same package-lock.json for all node / npm versions

Is it possible to have different node versions (lts and current) and have the same package-lock.json?
Currently when I run npm install the packages it generates are different to those specified in the package-lock.json file.
For example I'm using nvm (node version manager) to test different node versions on the same machine.
nvm exec v10.3.0 npm i outputs package-lock.json :
"babel-generator": {
"version": "6.26.1",
"resolved": "https://registry.npmjs.org/babel-generator/-/babel-generator-6.26.1.tgz",
"integrity": "sha512-HyfwY6ApZj7BYTcJURpM5tznulaBvyio7/0d4zFOeMPUmfxkCjHocCuoLa2SAGzBI8AREcH3eP3758F672DppA==",
"dev": true,
"requires": {
"babel-messages": "^6.23.0",
"babel-runtime": "^6.26.0",
"babel-types": "^6.26.0",
"detect-indent": "^4.0.0",
"jsesc": "^1.3.0",
"lodash": "^4.17.4",
"source-map": "^0.5.7",
"trim-right": "^1.0.1"
}
},
nvm exec v8.11.2 npm i outputs package-lock.json :
"babel-generator": {
"version": "6.26.1",
"resolved": "https://registry.npmjs.org/babel-generator/-/babel-generator-6.26.1.tgz",
"integrity": "sha512-HyfwY6ApZj7BYTcJURpM5tznulaBvyio7/0d4zFOeMPUmfxkCjHocCuoLa2SAGzBI8AREcH3eP3758F672DppA==",
"dev": true,
"requires": {
"babel-messages": "6.23.0",
"babel-runtime": "6.26.0",
"babel-types": "6.26.0",
"detect-indent": "4.0.0",
"jsesc": "1.3.0",
"lodash": "4.17.10",
"source-map": "0.5.7",
"trim-right": "1.0.1"
}
},
And because of that a lot of git conflicts keep happening between these two version.
Is there any configuration in package.json to have same output for package-lock.json ?

node peer dependency error with mongodb

Don't know how to get it to work after getting a long string of errors in the window. What else do I need to install or do? (using windows 10)
The error after typing npm install in git bash:
npm WARN peerDependencies The peer dependency mongodb#~1.4 included from mongoskin
npm WARN peerDependencies will no longer be automatically installed to fulfill the peerDependency npm WARN peerDependencies in npm 3+. Your application will need to depend on it explicitly.
kerberos#0.0.11 install C:\Users\Desktop\nodeblog\node_modules\monk\node_modules\mongodb\node_modules\kerberos
(node-gyp rebuild 2> builderror.log) || (exit 0)
My package.json file:
{
"name": "nodeblog",
"version": "1.0.0",
"private": true,
"scripts": {
"start": "node ./bin/www"
},
"dependencies": {
"body-parser": "1.13.x",
"connect-flash": "latest",
"cookie-parser": "1.3.x",
"debug": "~2.2.0",
"express": "4.13.x",
"express-messages": "latest",
"express-session": "latest",
"express-validator": "latest",
"jade": "1.9.x",
"moment": "latest",
"mongodb": "latest",
"monk": "latest",
"morgan": "1.5.x",
"multer": "latest",
"serve-favicon": "2.3.x"
}
}

Resources