create-react-app in WebStorm - node.js

I am attempting to use the npm package "create-react-app" to get started on a react project using WebStorm.
I have run npm install -g create-react-app to install the package globally, and can use the package perfectly fine with from the command line (i.e. create-react-app <proj name>).
However when creating a project in WebStorm and using the path to the global "create-react-app" package (found using npm list -g), I encounter this error:
/usr/bin/node /usr/local/lib/node_modules/create-react-app/index.js .
/usr/local/lib/node_modules/create-react-app/createReactApp.js:589
.filter(file => !validFiles.includes(file));
^
TypeError: validFiles.includes is not a function
at /usr/local/lib/node_modules/create-react-
app/createReactApp.js:589:33
at Array.filter (native)
at isSafeToCreateProjectIn (/usr/local/lib/node_modules/create-
react-app/createReactApp.js:589:6)
at createApp (/usr/local/lib/node_modules/create-react-
app/createReactApp.js:147:8)
at Object.<anonymous> (/usr/local/lib/node_modules/create-react-
app/createReactApp.js:134:1)
at Module._compile (module.js:410:26)
at Object.Module._extensions..js (module.js:417:10)
at Module.load (module.js:344:32)
at Function.Module._load (module.js:301:12)
at Module.require (module.js:354:17)
Done
Have I gone wrong at some point?

It turns out I had node version 4, and create-react-app requires version >= 6 - although this warning was not displayed via the WebStorm "Run" panel.
Thus I fixed this issue by updating to node v6.11.3, using nvm.

Related

TypeError: callSite.getFileName is not a function at callSiteLocation (/node_modules/depd/index.js:252:23) on npm start

When I am doing npm install in the project that I clone from github & then npm start I am getting error:
/Users/abc/Documents/Projects/test-project/node_modules/depd/index.js:252
var file = callSite.getFileName() || '<anonymous>'
^
TypeError: callSite.getFileName is not a function
at callSiteLocation (/Users/abc/Documents/Projects/test-project/node_modules/depd/index.js:252:23)
at depd (/Users/abc/Documents/Projects/test-project/node_modules/depd/index.js:111:14)
at Object.<anonymous> (/Users/abc/Documents/Projects/test-project/node_modules/body-parser/index.js:14:32)
at Module._compile (internal/modules/cjs/loader.js:678:30)
at Module._compile (/Users/abc/Documents/Projects/test-project/node_modules/pirates/lib/index.js:136:24)
at Module._extensions..js (internal/modules/cjs/loader.js:689:10)
at Object.newLoader [as .js] (/Users/abc/Documents/Projects/test-project/node_modules/pirates/lib/index.js:141:7)
at Module.load (internal/modules/cjs/loader.js:589:32)
at tryModuleLoad (internal/modules/cjs/loader.js:528:12)
at Function.Module._load (internal/modules/cjs/loader.js:520:3)
This 'depd' library is throwing error from all the occurrences as it is a dependancy in various npm packages like body-parser & express. So it is throwing error from within all of them.
However my existing setup from same github repo where I am not doing npm install from scratch seem to be working fine.
I have tried doing npm install with different nodeJs versions 6.9.5, 10.x.x, 11.x.x, 12.x.x
Also I am using Babel v7.
Upgrade Node.js to the latest LTS. I was on 12.x and had this error, so upgrading to 16.x fixed it.

"I got an error after reinstalling nodejs"

node:internal/modules/cjs/loader:1161 return process.dlopen(module,
path.toNamespacedPath(filename));
^
Error: The module '\?\G:\Discord
bot\Bot\ZackyBot\node_modules\canvas\build\Release\canvas.node' was
compiled against a different Node.js version using NODE_MODULE_VERSION
83. This version of Node.js requires NODE_MODULE_VERSION 88. Please try re-compiling or re-installing the module (for instance, using npm rebuild or npm install).
at Object.Module._extensions..node (node:internal/modules/cjs/loader:1161:18)
at Module.load (node:internal/modules/cjs/loader:967:32)
at Function.Module._load (node:internal/modules/cjs/loader:807:14)
at Module.require (node:internal/modules/cjs/loader:991:19)
at require (node:internal/modules/cjs/helpers:92:18)
at Object. (G:\Discord bot\Bot\ZackyBot\node_modules\canvas\lib\bindings.js:3:18)
at Module._compile (node:internal/modules/cjs/loader:1102:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1131:10)
at Module.load (node:internal/modules/cjs/loader:967:32)
at Function.Module._load (node:internal/modules/cjs/loader:807:14)
at Module.require (node:internal/modules/cjs/loader:991:19)
at require (node:internal/modules/cjs/helpers:92:18)
at Object. (G:\Discord bot\Bot\ZackyBot\node_modules\canvas\lib\canvas.js:9:18)
at Module._compile (node:internal/modules/cjs/loader:1102:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1131:10)
at Module.load (node:internal/modules/cjs/loader:967:32) { code: 'ERR_DLOPEN_FAILED' }
It seems like you installed a newer version of NodeJS than earlier. But you did not compile your project ZackyBot's node modules using the current version of the NodeJS you installed.
I would suggest you go to your project directory and clean all your node modules. Then reinstall them again. Follow the steps below:
Delete node_modules directory inside ZackyBot directory
Execute npm install command on a terminal from ZackyBot directory
Since you updated your nodeJS version to a newer one, you need to update your canvas too.
run npm install canvas and you should be good to go.
This might be due to improper installation of node modules and can occur due to poor network conditions.
Solved this issue by deleting the nodemodules folder and doing a clean installation of node modules files by running "npm install".

React Native CLI, Cannot find module '/usr/local/lib/node_modules/react-native-cli/node_modules/prompt/lib/prompt'

I'm having a problem installing the react native CLI
When I run react-native init or any other cli method
internal/modules/cjs/loader.js:296
throw err;
^
Error: Cannot find module '/usr/local/lib/node_modules/react-native-cli/node_modules/prompt/lib/prompt'. Please verify that the package.json has a valid "main" entry
at tryPackage (internal/modules/cjs/loader.js:288:19)
at Function.Module._findPath (internal/modules/cjs/loader.js:515:18)
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:759:27)
at Function.Module._load (internal/modules/cjs/loader.js:677:27)
at Module.require (internal/modules/cjs/loader.js:830:19)
at require (internal/modules/cjs/helpers.js:68:18)
at Object.<anonymous> (/usr/local/lib/node_modules/react-native-cli/index.js:43:14)
at Module._compile (internal/modules/cjs/loader.js:936:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:947:10)
at Module.load (internal/modules/cjs/loader.js:790:32) {
code: 'MODULE_NOT_FOUND',
path: '/usr/local/lib/node_modules/react-native-cli/node_modules/prompt/package.json',
requestPath: 'prompt'
}
Removed and re-installed using npm install -g react-native-cli but no luck.
node version v12.10.0,
npm version 6.10.3
This was resolved by completely removing Node and re-installing using homebrew
I was resolved by removing node and remove this folder /usr/local/lib/node_modules/react-native-cli/node_modules/ and reinstall node
run command (yarn add npm) if you have yarn
I have resolved my issue with this command

`ember install emberfire` failed, is ember-cli-emberfire a better route with Node 6.2.2?

Cannot find module 'q' and more…
When I run ember install emberfire in an existing Ember app, I get Cannot find module 'q'.
I searched the issue, tried npm cache clean and npm install q.
Now, ember install emberfire throws Cannot find module '../function/makeIterator_' and I'm reluctant to go further.
However, at npm-embercli-emberfire the advice is to install via Bower with npm install --save-dev ember-cli-emberfire - to quote:
This repo lists emberFire as a bower dependency
It runs bower install as the npm postinstall script
it exports a tree containing both the firebase and emberFire libraries
Do node 6.2.2 and ember-cli play nicely yet?
Since the machinations of npm and Node become an irritating mystery when I'm trying to focus on an Ember (tutorial) app, I'd like to know:
how running ember install emberfire differs, and if running it before running the npm-recommended command is an issue?
If it's okay to run ember-cli with node 6.2.2 - if not, suggestions?
My setup
OS X 10.11.6 (and just had to chown -R usr/local after an OS X update).
node 6.2.2 (which apparently "has currently not been tested against Ember CLI and may result in unexpected behaviour.")
Ember: 1.13.15
ember-cli: 1.13.15
ember-data: 2.7.0
node: 6.2.2
npm: 2.14.10
emberfire: 2.0.1
ember-cli-emberfire: 0.0.1
The full error readout:
$ ember install emberfire
version: 1.13.15
Installed packages for tooling via npm.
installing emberfire
identical app/adapters/application.js
Cannot find module 'q'
Error: Cannot find module 'q'
at Function.Module._resolveFilename (module.js:336:15)
at Function.Module._load (module.js:278:25)
at Module.require (module.js:365:17)
at require (module.js:384:17)
at Object.<anonymous> (/Users/admin/projects/solutions-log/node_modules/ember-cli/node_modules/bower/lib/commands/index.js:1:71)
at Module._compile (module.js:460:26)
at Object.Module._extensions..js (module.js:478:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Module.require (module.js:365:17)
$ npm cache clean
$ npm install q
solutions-log#0.0.0 /Users/admin/projects/solutions-log
└── q#1.4.1
$ ember install emberfire
version: 1.13.15
Installed packages for tooling via npm.
installing emberfire
identical app/adapters/application.js
Cannot find module '../function/makeIterator_'
Error: Cannot find module '../function/makeIterator_'
at Function.Module._resolveFilename (module.js:336:15)
at Function.Module._load (module.js:278:25)
at Module.require (module.js:365:17)
at require (module.js:384:17)
at Object.<anonymous> (/Users/admin/projects/solutions-log/node_modules/ember-cli/node_modules/bower/lib/node_modules/mout/array/collect.js:2:20)
at Module._compile (module.js:460:26)
at Object.Module._extensions..js (module.js:478:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Module.require (module.js:365:17)

Getting error: Cannot find module 'errno' running node script

I've just installed a fresh copy of Ubuntu 15.10, node 4.2.2 and npm 2.14.7 (with nvm) on a new machine. I have installed webpack and webpack-dev-server globally and installed my project dependencies with npm i.
Now when I try to run my node server I get the following errors:
module.js:339
throw err;
^
Error: Cannot find module 'errno'
at Function.Module._resolveFilename (module.js:337:15)
at Function.Module._load (module.js:287:25)
at Module.require (module.js:366:17)
at require (module.js:385:17)
at Object.<anonymous> (/node_modules/webpack-dev-middleware/node_modules/memory-fs/lib/MemoryFileSystem.js:7:14)
at Module._compile (module.js:435:26)
at Object.Module._extensions..js (module.js:442:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:311:12)
at Module.require (module.js:366:17)
at require (module.js:385:17)
Any suggestions please?
Node.js searches for modules in the ./node_modules/ directory in the path where the program is.
For example if you script is here /home/user/scripts/somescript.js you should have /home/user/scripts/node_modules/.
Just do npm install errno in here /home/user/scripts/.
It seems that something had gone wrong with my npm install and my project dependencies were only partly installed. Just running npm install again didn't fix it. I did an npm cache clean, removed my node_modules directory and then ran npm install again. The problem was then resolved.

Resources