I just found out about immutable.js.
I want to play around with it, get used to how it works.
Really simple. Don't even need to write code, just futzing with
it in the node shell interactively.
I have installed it:
$ npm install immutable
npm WARN saveError ENOENT: no such file or directory, open '/home/xxxxxxx/node/immutable/package.json'
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN enoent ENOENT: no such file or directory, open '/home/xxxxxxx/node/immutable/package.json'
npm WARN immutable No description
npm WARN immutable No repository field.
npm WARN immutable No README data
npm WARN immutable No license field.
+ immutable#3.8.2
added 1 package from 1 contributor and audited 1 package in 2.934s
found 0 vulnerabilities
...and then I attempt to work with it.
$ node
> const { Map } = require('immutable');
ReferenceError: Map is not defined
at Module._compile (internal/modules/cjs/loader.js:683:37)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
at Module.load (internal/modules/cjs/loader.js:599:32)
at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
at Function.Module._load (internal/modules/cjs/loader.js:530:3)
at Module.require (internal/modules/cjs/loader.js:637:17)
at require (internal/modules/cjs/helpers.js:20:18)
$ node -v
v10.10.0
$ npm -v
6.4.1
A little assistance in making sense of what I may have missed would be really cool.
TIA
UPDATE:
Just for the heck of it I tried this:
$ sudo npm install immutable
And now it works
???
Related
I clone the project from GitLab -> install node_modules by "npm install -g" -> and run "npm start" command in terminal but it give some errors as below.
Error Cannot find module '../services/'
Require stack:
- /opt/projects/api_server_node/node_modules/ravepay/lib/rave.bvn.js
- /opt/projects/api_server_node/node_modules/ravepay/index.js
- /opt/projects/api_server_node/services/flutterwaveService.js
- /opt/projects/api_server_node/controllers/flutterwaveController.js
- /opt/projects/api_server_node/controllers/bookingController.js
- /opt/projects/api_server_node/routes/booking.js
- /opt/projects/api_server_node/index.js
Error: Cannot find module '../services/'
Require stack:
- /opt/projects/api_server_node/node_modules/ravepay/lib/rave.bvn.js
- /opt/projects/api_server_node/node_modules/ravepay/index.js
- /opt/projects/api_server_node/services/flutterwaveService.js
- /opt/projects/api_server_node/controllers/flutterwaveController.js
- /opt/projects/api_server_node/controllers/bookingController.js
- /opt/projects/api_server_node/routes/booking.js
- /opt/projects/api_server_node/index.js
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:1029:15)
at Function.Module._load (internal/modules/cjs/loader.js:898:27)
at Module.require (internal/modules/cjs/loader.js:1089:19)
at require (internal/modules/cjs/helpers.js:73:18)
at Object.<anonymous>
(/opt/projects/api_server_node/node_modules/ravepay/lib/rave.bvn.js:2:22)
at Module._compile (internal/modules/cjs/loader.js:1200:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1220:10)
at Module.load (internal/modules/cjs/loader.js:1049:32)
at Function.Module._load (internal/modules/cjs/loader.js:937:14)
at Module.require (internal/modules/cjs/loader.js:1089:19)
at require (internal/modules/cjs/helpers.js:73:18)
at Object.<anonymous> (/opt/projects/api_server_node/node_modules/ravepay/index.js:17:11)
at Module._compile (internal/modules/cjs/loader.js:1200:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1220:10)
at Module.load (internal/modules/cjs/loader.js:1049:32)
at Function.Module._load (internal/modules/cjs/loader.js:937:14)
at Module.require (internal/modules/cjs/loader.js:1089:19)
at require (internal/modules/cjs/helpers.js:73:18)
at Object.<anonymous> (/opt/projects/api_server_node/services/flutterwaveService.js:16:17)
at Module._compile (internal/modules/cjs/loader.js:1200:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1220:10)
at Module.load (internal/modules/cjs/loader.js:1049:32)
at Function.Module._load (internal/modules/cjs/loader.js:937:14)
at Module.require (internal/modules/cjs/loader.js:1089:19)
at require (internal/modules/cjs/helpers.js:73:18)
at Object.<anonymous>
(/opt/projects/api_server_node/controllers/flutterwaveController.js:28:20)
at Module._compile (internal/modules/cjs/loader.js:1200:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1220:10)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! bookadabra_api#1.0.0 start: `node ./index.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the bookadabra_api#1.0.0 start script.
npm ERR! This is probably not a problem with npm. The`enter code here`re is likely
additional logging output above.```
screeshot of the error (https://prnt.sc/vpykry)
TL;DR: Downgrade the ravepay module from 1.3.0 to 1.2.4, but do take time to read the WARNING paragraph below first.
The stack trace indicates that your issue is in the ravepay module. Trying to use a plain installation of ravepay resulted in a similar error to what you're seeing for every version of Node.js I tried (15.x, 14.x, 12.x, and 10.x--all the versions currently supported by the Node.js project at the time of this writing).
There's no information about Node.js version support for ravepay, or at least not that I can find as of this writing. However, looking at their GitHub Action at the time of this writing reveals that they use Node.js 12.x. But using 12.x didn't help.
The current version of ravepay is 1.3.0. Downgrading to 1.2.4 fixes the issue.
$ node -v
v15.3.0
$ npm -v
7.0.14
$ npm install ravepay
npm WARN deprecated har-validator#5.1.5: this library is no longer supported
npm WARN deprecated request#2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
added 61 packages, and audited 61 packages in 3s
2 packages are looking for funding
run `npm fund` for details
2 high severity vulnerabilities
Some issues need review, and may require choosing
a different dependency.
Run `npm audit` for details.
$ npm ls ravepay
temp# /Users/trott/temp
└── ravepay#1.3.0
$ node -e "require('ravepay')"
node:internal/modules/cjs/loader:922
throw err;
^
Error: Cannot find module '../services/'
Require stack:
- /Users/trott/temp/node_modules/ravepay/lib/rave.bvn.js
- /Users/trott/temp/node_modules/ravepay/index.js
- /Users/trott/temp/[eval]
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:919:15)
at Function.Module._load (node:internal/modules/cjs/loader:763:27)
at Module.require (node:internal/modules/cjs/loader:991:19)
at require (node:internal/modules/cjs/helpers:92:18)
at Object.<anonymous> (/Users/trott/temp/node_modules/ravepay/lib/rave.bvn.js:2:22)
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) {
code: 'MODULE_NOT_FOUND',
requireStack: [
'/Users/trott/temp/node_modules/ravepay/lib/rave.bvn.js',
'/Users/trott/temp/node_modules/ravepay/index.js',
'/Users/trott/temp/[eval]'
]
}
$ npm install ravepay#1.2.4
changed 1 package, and audited 61 packages in 1s
2 packages are looking for funding
run `npm fund` for details
2 high severity vulnerabilities
Some issues need review, and may require choosing
a different dependency.
Run `npm audit` for details.
$ npm ls
temp# /Users/trott/temp
└── ravepay#1.2.4
$ node -e "require('ravepay')"
$
WARNING: Even though that "fixes" the problem, those high severity audit warnings are not a reassuring sign on a credit card payment library. The ravepay module is relatively lightly used (227 weekly downloads at the time of this writing) and was last published a year ago (at the time of this writing). It is probably not much actively maintained and there is not evidence of a user base large enough to frequently surface simple issues like this and make solutions readily available to a user community. If you continue down this path, you may experience more problems like this. Be prepared.
EDIT: Oh yeah, and as #Andrei Ionita notes in their answer, don't install the project dependencies with the -g flag.
Try clearing your globally installed packages and installing the project without the -g flag.
I recently created an api called jkanime using Typescript. I have the problem after publishing it on the npm platform, it shows me an error when using the API functions.
The error comes from the imports of some packages that I use to create the jkanime API.
Here I leave the api repository, if someone wants to help me how to correctly upload the package to the npm platform. https://github.com/ChrisMichaelPerezSantiago/jkanime
var jkanime = require("jkanime");
jkanime.lastAnimesAdded()
.then(doc => console.log(doc));
Error
import * as cheerio from 'cheerio';
^
SyntaxError: Unexpected token *
at Module._compile (internal/modules/cjs/loader.js:721:23)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)
at Module.require (internal/modules/cjs/loader.js:690:17)
at require (internal/modules/cjs/helpers.js:25:18)
at Object.<anonymous> (C:\Users\c\Desktop\jkanime\test\index.js:1:13)
at Module._compile (internal/modules/cjs/loader.js:776:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! test#1.0.0 start: `node index.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the test#1.0.0 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\c\AppData\Roaming\npm-cache\_logs\2019-08-16T01_07_55_949Z-debug.log
RunKit Link: https://npm.runkit.com/jkanime
You probably did not build your library before publishing also in package.json I see your main file is set to index.js and its nowhere to be seen?
I would advise you to use something like typescript-library-starter for creating typescript libraries at least check it to see what you need to create a library project with typescript.
I have installed node.js. Node seems to be working properly, however, npm is not being found, as you can see below.
C:\Users\jpdrc>node -v
v6.5.0
C:\Users\jpdrc>node hello.js
node is installed!
C:\Users\jpdrc>npm -v
module.js:457
throw err;
^
Error: Cannot find module 'strip-ansi'
at Function.Module._resolveFilename (module.js:455:15)
at Function.Module._load (module.js:403:25)
at Module.require (module.js:483:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (C:\Users\jpdrc\AppData\Roaming\npm\node_modules\npm\node_modules\npmlog\node_modules\gauge\node_modules\string-width\index.js:2:17)
at Module._compile (module.js:556:32)
at Object.Module._extensions..js (module.js:565:10)
at Module.load (module.js:473:32)
at tryModuleLoad (module.js:432:12)
at Function.Module._load (module.js:424:3)
I have tried multiple solutions as the ones presented:
1- Windows -installed node.js but npm not found
2- Installing Node.js (and npm) on Windows 10
I have no idea what to try next
Thanks for the assistance
Here are my variables under path
As suggested below I have used where npm
C:\Users\jpdrc>where npm
C:\Program Files\nodejs\npm
C:\Program Files\nodejs\npm.cmd
Steps for solving the above issue:
Check that you have added the path of node in environment variable "path"
If it is there then check that npm is there in the directory which you have added in the path.
If npm is there in the required folder then go to CMD and then go to directory where npm is installed and try to run the version command again. If still you are getting the same issue then there could be two possibilities:
a. Installation is incorrect, try installing again
b. There could be proxy issue due to which packages are not getting downloaded
There cannot be any other issue.
You should be able to run the npm -v in the git bash terminal window. If you don't even have the git-bash app, then download and install git on your Windows.
I tried to setup ghost after installing node.js but as I run the install for ghost as
npm install --productions
It gives me the following error
> ghost#0.5.10 start /home/kedarkhetia/Downloads/ghost-0.5.10
> node index
module.js:340
throw err;
^
Error: Cannot find module 'streamsearch'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object.<anonymous> (/home/kedarkhetia/Downloads/ghost-0.5.10/node_modules/busboy/node_modules/dicer/lib/Dicer.js:5:20)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
npm ERR! weird error 8
npm WARN This failure might be due to the use of legacy binary "node"
npm WARN For further explanations, please read
/usr/share/doc/nodejs/README.Debian
npm ERR! not ok code 0
any help is appreciated.
Try running
npm install streamsearch
Does this work?
This may be related:
Cannot install packages using node package manager in Ubuntu
Make sure you have installed streamsearch.
npm install streamsearch
If it is still not working, check that you have cloned stable for production or not. If you did, re-clone it and do installation steps again. Use sudo for npm/grunt commands (if you are on OSX or Linux) for npm ERR!.
I just looked at the Ghost Docs, and it says to install the dependencies for production you must run npm install --production and not npm install --productions. Once you install streamsearch, it will keep complaining until you have installed all the individual dependencies with npm install --production.
Hope this helps!
After I switch from one node.js version to another with n module - https://github.com/visionmedia/n/, my npm is broken...
MacBook-Pro-Dmitri:~ dmitri$ npm --version
module.js:340
throw err;
^
Error: Cannot find module 'npmlog'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Module.require (module.js:362:17)
at require (module.js:378:17)
at /usr/local/bin/npm:19:11
at Object.<anonymous> (/usr/local/bin/npm:87:3)
at Module._compile (module.js:449:26)
at Object.Module._extensions..js (module.js:467:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
then i'm installing npm again as it was adviced here - https://github.com/visionmedia/n/issues/101
curl https://npmjs.org/install.sh | sh
npm begins to work..
but then i do another switch for node version:
n 0.8.22
and npm now is broken again with the same error.
it's very annoying.. do I need to install npm manually after every version switch?!
Are there different global package repositories for different versions?
Perhaps either that package needs to be re-installed globally sudo npm install -g or the package manage cache cleaned sudo npm cache clean after switching version(s).
Node and npm should get bundled together these days, if you are a frequent version changer like me. You can try installing node with NVM
https://github.com/creationix/nvm
This will help you differentiate packages in different node versions. Just do a npm install after the switch.
PS: The current node version is quite stable right now. You can just use the current version instead of 0.8.22
You could try installing npmlog manually: npm install -g npmlog
I had the same problem and couldn’t find a solution.
It seems that n is less well maintained than nvm so I completely removed node following these steps and re-installed it using nvm.
(And node now includes npm)
I had same problem on windows. I uninstalled node, deleted everything from its install directory and re-installed. After restarting command line, I got npm working again.