After I read prisma article,I can execute npm install prisma --save-dev and npx prisma. After that,
I searched where prisma cli was installed.
multiple cli has symbolic link from node_modules/.bin to its actual file,so I searchprismain this directory but it couldn't be found. where is prisma cli installed ?
~/test/src/test% ls -ltr node_modules/.bin
total 0
lrwxrwxrwx 1 hikarmiy amazon 17 Jan 28 03:08 ts-jest -> ../ts-jest/cli.js
lrwxrwxrwx 1 hikarmiy amazon 27 Jan 28 03:08 prettier -> ../prettier/bin-prettier.js
lrwxrwxrwx 1 hikarmiy amazon 15 Jan 28 03:08 lerna -> ../lerna/cli.js
lrwxrwxrwx 1 hikarmiy amazon 21 Feb 1 04:42 npx -> ../npm/bin/npx-cli.js
lrwxrwxrwx 1 hikarmiy amazon 45 Feb 1 04:42 npm-install-peers -> ../npm-install-peers/bin/npm-install-peers.js
lrwxrwxrwx 1 hikarmiy amazon 21 Feb 1 04:42 npm -> ../npm/bin/npm-cli.js
lrwxrwxrwx 1 hikarmiy amazon 26 Feb 1 09:06 tsserver -> ../typescript/bin/tsserver
lrwxrwxrwx 1 hikarmiy amazon 21 Feb 1 09:06 tsc -> ../typescript/bin/tsc
Thanks
Related
I am trying to test my code with TestCafe
node testcafe.js
(node:15092) Warning: To load an ES module, set "type": "module" in the package.json or use the .mjs extension.
(Use `node --trace-warnings ...` to show where the warning was created)
/home/miki/restwitherrors/test/testcafe.js:1
import http from 'http';
^^^^^^
SyntaxError: Cannot use import statement outside a module
My folder structure
-rw-r--r-- 1 miki miki 454 мај 1 12:08 .eslintrc.json
drwxr-xr-x 8 miki miki 4096 мај 11 09:13 .git/
-rw-rw-r-- 1 miki miki 13 мај 1 12:13 .gitignore
-rw-r--r-- 1 miki miki 2348 мај 10 18:29 index.js
-rw-r--r-- 1 miki miki 145117 мај 1 12:54 isolate-0x5c4ec90-24834-v8.log
drwxr-xr-x 356 miki miki 12288 мај 10 19:08 node_modules/
-rw-r--r-- 1 miki miki 980 мај 11 09:16 package.json
-rw-r--r-- 1 miki miki 148763 мај 1 12:08 package-lock.json
drwxr-xr-x 2 miki miki 4096 мај 10 18:44 test/
drwxrwxr-x 2 miki miki 4096 мај 10 19:23 .vscode/
If I add "type": "module" in the package.json ,I have different kind of problems.
node index
file:///home/miki/restwitherrors/index.js:1
const express = require("express")
^
ReferenceError: require is not defined
Or
node testcafe.js
file:///home/miki/restwitherrors/test/testcafe.js:15
fixture `Test REST API`;
^
ReferenceError: fixture is not defined
How to fix this?
newbie here. I had recently switched over to Visual Studio Code to work with Brain.js but when I go to install it into the terminal (With NPM), I get an Error. I have tried multiple other solutions but none work. Any help would be appreciated. Thanx in advance =>
Since I am new also at Linux, I had tried a few variations of install commands(like sudo) and tried to complete the Brain.js installation on Default Linux terminal but to no avail :( . Also a weird thing is that I was able to download BrainJS(Older lib.) but not Brain.js
Even though i don't think there is any problem with the code, Here is it anyways.
const brain = require("brainjs");
let net = new brain.NeuralNetwork({ hiddenLayers: [3] }); //
Setting up neural network
const restaurants = { // Dataset
"KFC":"Monday",
"Item no.1":"Tuesday",
"Vaango":"Wednesday",
"Taco Bell":"Thursday",
"carls Jr.":"Friday",
"":"Saturday",
"Burger King":"Sunday"
}
const TrainingData = [];
for (let restaurantName in restaurants) {
const dayOfWeek = restaurants[restaurantName];
TrainingData.push({
input: { [dayOfWeek]: 1 },
output: { [restaurantName]: 1 }
});
}
const stats = net.train(TrainingData);
THIS IS THE ERROR MSG I AM GETTING:
npm ERR! Linux 5.0.0-23-generic
npm ERR! argv "/usr/bin/node" "/usr/bin/npm" "install" "brain.js"
npm ERR! node v8.10.0
npm ERR! npm v3.5.2
npm ERR! code EMISSINGARG
npm ERR! typeerror Error: Missing required argument #1
npm ERR! typeerror at andLogAndFinish (/usr/share/npm/lib/fetch-
package-metadata.js:31:3)
npm ERR! typeerror at fetchPackageMetadata
(/usr/share/npm/lib/fetch-package-metadata.js:51:22)
npm ERR! typeerror at resolveWithNewModule
(/usr/share/npm/lib/install/deps.js:456:12)
npm ERR! typeerror at /usr/share/npm/lib/install/deps.js:190:5
npm ERR! typeerror at
/usr/share/npm/node_modules/slide/lib/async-map.js:52:35
npm ERR! typeerror at Array.forEach (<anonymous>)
npm ERR! typeerror at
/usr/share/npm/node_modules/slide/lib/async-map.js:52:11
npm ERR! typeerror at Array.forEach (<anonymous>)
npm ERR! typeerror at asyncMap
(/usr/share/npm/node_modules/slide/lib/async-map.js:51:8)
npm ERR! typeerror at exports.loadRequestedDeps (/usr/share/npm/lib/install/deps.js:188:3)
npm ERR! typeerror This is an error with npm itself. Please report this error at:
npm ERR! typeerror <http://github.com/npm/npm/issues>
npm ERR! Please include the following file with any support request:
npm ERR! /home/neel/Documents/VS-Code_Projects/npm-debug.log
AND THE DEBUG LOG:--
0 info it worked if it ends with ok
1 verbose cli [ '/usr/bin/node', '/usr/bin/npm', 'install', 'brain.js' ]
2 info using npm#3.5.2
3 info using node#v8.10.0
4 verbose config Skipping project config: /home/neel/.npmrc. (matches userconfig)
5 silly loadCurrentTree Starting
6 silly install loadCurrentTree
7 silly install readLocalPackageData
8 silly fetchPackageMetaData brain.js
9 silly fetchNamedPackageData brain.js
10 silly mapToRegistry name brain.js
11 silly mapToRegistry using default registry
12 silly mapToRegistry registry https://registry.npmjs.org/
13 silly mapToRegistry uri https://registry.npmjs.org/brain.js
14 verbose request uri https://registry.npmjs.org/brain.js
15 verbose request no auth needed
16 info attempt registry request try #1 at 21:59:12
17 verbose request id 74a22560d1b7c23a
18 verbose etag W/"9fb16e14a6b8c1d1ef1c110acba9db6b"
19 verbose lastModified Fri, 09 Aug 2019 11:09:50 GMT
20 http request GET https://registry.npmjs.org/brain.js
21 http 304 https://registry.npmjs.org/brain.js
22 verbose headers { date: 'Tue, 13 Aug 2019 16:29:14 GMT',
22 verbose headers connection: 'keep-alive',
22 verbose headers 'set-cookie':
22 verbose headers [ '__cfduid=d4bf1b2abca3b24131a1907349098099d1565713753; expires=Wed, 12-Aug-20 16:29:13 GMT; path=/; domain=.npmjs.org; HttpOnly' ],
22 verbose headers 'cf-cache-status': 'REVALIDATED',
22 verbose headers 'cache-control': 'max-age=300',
22 verbose headers 'cf-ray': '505c110c8bc58a5f-BOM',
22 verbose headers etag: '"9fb16e14a6b8c1d1ef1c110acba9db6b"',
22 verbose headers 'expect-ct': 'max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"',
22 verbose headers 'last-modified': 'Fri, 09 Aug 2019 11:09:50 GMT',
22 verbose headers vary: 'accept-encoding, accept',
22 verbose headers 'x-amz-meta-rev': '67-25f3ef5cf61222403c910fbd6b789aa9',
22 verbose headers server: 'cloudflare' }
23 silly get cb [ 304,
23 silly get { date: 'Tue, 13 Aug 2019 16:29:14 GMT',
23 silly get connection: 'keep-alive',
23 silly get 'set-cookie':
23 silly get [ '__cfduid=d4bf1b2abca3b24131a1907349098099d1565713753; expires=Wed, 12-Aug-20 16:29:13 GMT; path=/; domain=.npmjs.org; HttpOnly' ],
23 silly get 'cf-cache-status': 'REVALIDATED',
23 silly get 'cache-control': 'max-age=300',
23 silly get 'cf-ray': '505c110c8bc58a5f-BOM',
23 silly get etag: '"9fb16e14a6b8c1d1ef1c110acba9db6b"',
23 silly get 'expect-ct': 'max-age=604800, report-uri="https://report-uri.cloudflare.com/cdn-cgi/beacon/expect-ct"',
23 silly get 'last-modified': 'Fri, 09 Aug 2019 11:09:50 GMT',
23 silly get vary: 'accept-encoding, accept',
23 silly get 'x-amz-meta-rev': '67-25f3ef5cf61222403c910fbd6b789aa9',
23 silly get server: 'cloudflare' } ]
24 verbose etag https://registry.npmjs.org/brain.js from cache
25 verbose get saving brain.js to /home/neel/.npm/registry.npmjs.org/brain.js/.cache.json
26 silly install normalizeTree
27 silly loadCurrentTree Finishing
28 silly loadIdealTree Starting
29 silly install loadIdealTree
30 silly cloneCurrentTree Starting
31 silly install cloneCurrentTreeToIdealTree
32 silly cloneCurrentTree Finishing
33 silly loadShrinkwrap Starting
34 silly install loadShrinkwrap
35 silly loadShrinkwrap Finishing
36 silly loadAllDepsIntoIdealTree Starting
37 silly install loadAllDepsIntoIdealTree
38 verbose stack Error: Missing required argument #1
38 verbose stack at andLogAndFinish (/usr/share/npm/lib/fetch-package-metadata.js:31:3)
38 verbose stack at fetchPackageMetadata (/usr/share/npm/lib/fetch-package-metadata.js:51:22)
38 verbose stack at resolveWithNewModule (/usr/share/npm/lib/install/deps.js:456:12)
38 verbose stack at /usr/share/npm/lib/install/deps.js:190:5
38 verbose stack at /usr/share/npm/node_modules/slide/lib/async-map.js:52:35
38 verbose stack at Array.forEach (<anonymous>)
38 verbose stack at /usr/share/npm/node_modules/slide/lib/async-map.js:52:11
38 verbose stack at Array.forEach (<anonymous>)
38 verbose stack at asyncMap (/usr/share/npm/node_modules/slide/lib/async-map.js:51:8)
38 verbose stack at exports.loadRequestedDeps (/usr/share/npm/lib/install/deps.js:188:3)
39 verbose cwd /home/neel/Documents/VS-Code_Projects
40 error Linux 5.0.0-23-generic
41 error argv "/usr/bin/node" "/usr/bin/npm" "install" "brain.js"
42 error node v8.10.0
43 error npm v3.5.2
44 error code EMISSINGARG
45 error typeerror Error: Missing required argument #1
45 error typeerror at andLogAndFinish (/usr/share/npm/lib/fetch-package-metadata.js:31:3)
45 error typeerror at fetchPackageMetadata (/usr/share/npm/lib/fetch-package-metadata.js:51:22)
45 error typeerror at resolveWithNewModule (/usr/share/npm/lib/install/deps.js:456:12)
45 error typeerror at /usr/share/npm/lib/install/deps.js:190:5
45 error typeerror at /usr/share/npm/node_modules/slide/lib/async-map.js:52:35
45 error typeerror at Array.forEach (<anonymous>)
45 error typeerror at /usr/share/npm/node_modules/slide/lib/async-map.js:52:11
45 error typeerror at Array.forEach (<anonymous>)
45 error typeerror at asyncMap (/usr/share/npm/node_modules/slide/lib/async-map.js:51:8)
45 error typeerror at exports.loadRequestedDeps (/usr/share/npm/lib/install/deps.js:188:3)
46 error typeerror This is an error with npm itself. Please report this error at:
46 error typeerror <http://github.com/npm/npm/issues>
47 verbose exit [ 1, true ]
You state:
Error installing brain.js
But when you go to install require it, you are using "brainjs", not "brain.js":
const brain = require("brainjs");
You are referencing two different libraries, though different by one character. Use this:
const brain = require('brain.js');
npm ERR! npm v3.5.2
As discussed in the comments, this is an old version of NPM and the solution was to update to a newer version.
I am using Ubuntu 14.04 and have installed nodejs and npm with:
sudo apt-get install nodejs npm
Then I made a symlink to enable packages to use the node interpreter (instead of nodejs):
sudo ln -s /usr/bin/nodejs /usr/local/bin/node
I installed coffee-script (for testing purposes) and my own package, mangarack, with:
sudo npm -g install coffee-script mangarack
When I run coffee (part of coffee-script), that package will run fine. If I run mangarack, I will get:
: No such file or directory.
I have the following in my package.json:
"bin": {
"mangarack": "./bin/mangarack"
},
And that file contains:
#!/usr/bin/env node
require('../lib/cli/index');
I looked at how coffee-script did it and it seems like my require statement is absolutely wrong, so I replaced that with a console.log statement to see if the file would actually run in node. It doesn't. What did I miss or miss-configure to enable Linux-based machines to run this package?
Full source code references:
npm: https://www.npmjs.org/package/mangarack
git: https://github.com/Deathspike/mangarack.js
The problem is the file bin/mangarack uses carriage return, which causes error in linux environment. see what I got:
$ mangarack --help
env: node\r: No such file or directory
$ head -n 1 `which mangarack` | hexdump
0000000 23 21 2f 75 73 72 2f 62 69 6e 2f 65 6e 76 20 6e
0000010 6f 64 65 0d 0a
0000015
Notice the character \r(0d in hex mode) after node. you should remove it.
Solution: setup your project with $ git config core.autocrlf then commit changes afterwards. see https://help.github.com/articles/dealing-with-line-endings/
the expected result after fix should be:
$ head -n 1 `which mangarack` | hexdump
0000000 23 21 2f 75 73 72 2f 62 69 6e 2f 65 6e 76 20 6e
0000010 6f 64 65 0a
0000015
i have node v.0.10.30 and npm 1.4.21 installed,
when i execute this command
npm install express
i get this as a result
Error: shasum check failed for /tmp/npm-4273-g1Rb0gCE/registry.npmjs.org/express/- /express-4.9.7.tgz
npm ERR! Expected: ae3e0bdf0095749467fde125afd77e7988ff0fbb
npm ERR! Actual: da39a3ee5e6b4b0d3255bfef95601890afd80709
npm ERR! From: https://registry.npmjs.org/express/-/express-4.9.7.tgz
npm ERR! at /usr/lib/node_modules/npm/node_modules/sha/index.js:38:8
npm ERR! at ReadStream.<anonymous>(/usr/lib/node_modules/npm/node_modules/sha/index.js:85:7)
npm ERR! at ReadStream.emit (events.js:117:20)
npm ERR! at _stream_readable.js:938:16
npm ERR! at process._tickCallback (node.js:419:13)
more log from npm-debug.log file
0 info it worked if it ends with ok
1 verbose cli [ '/usr/bin/node', '/usr/bin/npm', 'install', 'express' ]
2 info using npm#1.4.21
3 info using node#v0.10.30
4 verbose node symlink /usr/bin/node
5 warn package.json app#0.0.0 No description
6 warn package.json app#0.0.0 No repository field.
7 warn package.json app#0.0.0 No README data
8 verbose readDependencies using package.json deps
9 verbose cache add [ 'express', null ]
19 verbose lock express# /home/wilson/.npm/64a534c1-express.lock
20 silly addNameRange { name: 'express', range: '*', hasData: false }
21 verbose request where is /express
22 verbose request registry https://registry.npmjs.org/
23 verbose request id a071fcd68daa94eb
24 verbose url raw /express
25 verbose url resolving [ 'https://registry.npmjs.org/', './express' ]
26 verbose url resolved https://registry.npmjs.org/express
27 verbose request where is https://registry.npmjs.org/express
28 info trying registry request attempt 1 at 20:00:01
29 verbose etag "7FVLRT9Y9RQJKGVQC7099FKQ4"
30 http GET https://registry.npmjs.org/express
31 http 304 https://registry.npmjs.org/express
32 silly registry.get cb [ 304,
32 silly registry.get { date: 'Sat, 11 Oct 2014 00:00:01 GMT',
32 silly registry.get server: 'Apache',
32 silly registry.get via: '1.1 varnish',
32 silly registry.get 'last-modified': 'Fri, 10 Oct 2014 23:59:57 GMT',
32 silly registry.get 'cache-control': 'max-age=60',
32 silly registry.get etag: '"7FVLRT9Y9RQJKGVQC7099FKQ4"',
32 silly registry.get 'x-served-by': 'cache-iad2130-IAD',
32 silly registry.get 'x-cache': 'HIT',
32 silly registry.get 'x-cache-hits': '2',
32 silly registry.get 'x-timer': 'S1412985601.881420,VS0,VE0',
32 silly registry.get vary: 'Accept',
32 silly registry.get 'content-length': '0',
32 silly registry.get 'keep-alive': 'timeout=10, max=50',
32 silly registry.get connection: 'Keep-Alive' } ]
33 verbose etag https://registry.npmjs.org/express from cache
34 silly addNameRange number 2 { name: 'express', range: '*', hasData: true }
my os is ubuntu 14.04
npm command recommended me to report this log at npm's github repository
download the file https://registry.npmjs.org/express/-/express-4.9.7.tgz
then install from the file
npm install ./express-4.9.7.tgz
Some of these error messages will typically come up when you are not accessing the root admin of the system while executing the install.
When I opened the terminal and ran $ sudo -i to access the #root and then entered $ npm install express , it was installed correctly. Hopefully this helps!
I had a similar issue which was caused by a corrupt download.
It was easily solved by purging the offending package from the cache and re-running the installation.
$ npm cache clean express
$ npm i express
(in my case the corrupt package was a dependency, so I purged it from cache, and not the package that I was trying to install, of course)
First start command prompt as an administrator then run your command.
okay so i am running centos 6.5 with zpanel setup.
this then has phantom js and casperjs both setup and working it the
/usr/local/bin
directory.
i use this php command for phantomjs and casperjs
echo exec('/usr/local/bin/casperjs --version 2>&1');
phantomjs works fine but casperjs gives me this error
sh: /usr/local/bin/casperjs: Permission denied
can anyone out there help me fix this problem it is just a pain
output for ls -al casperjs
[root#cyber-hosted ~]# ls -al casperjs
total 100
drwxr-xr-x 10 apache root 4096 Feb 4 15:49 .
dr-xr-x---. 5 root root 4096 Feb 4 15:49 ..
drwxr-xr-x 2 root root 4096 Feb 4 15:49 bin
-rw-r--r-- 1 root root 1220 Feb 4 15:49 casperjs.gemspec
-rw-r--r-- 1 root root 75 Feb 4 15:49 CHANGELOG.md
-rw-r--r-- 1 root root 4929 Feb 4 15:49 CONTRIBUTING.md
-rw-r--r-- 1 root root 1524 Feb 4 15:49 CONTRIBUTORS.md
drwxr-xr-x 6 root root 4096 Feb 4 15:49 docs
drwxr-xr-x 8 root root 4096 Feb 4 15:49 .git
-rw-r--r-- 1 root root 12 Feb 4 15:49 .gitattributes
-rw-r--r-- 1 root root 71 Feb 4 15:49 .gitignore
-rw-r--r-- 1 root root 0 Feb 4 15:49 .gitmodules
-rw-r--r-- 1 root root 145 Feb 4 15:49 .jshintignore
-rw-r--r-- 1 root root 528 Feb 4 15:49 .jshintrc
-rw-r--r-- 1 root root 1066 Feb 4 15:49 LICENSE.md
-rw-r--r-- 1 root root 552 Feb 4 15:49 Makefile
drwxr-xr-x 2 root root 4096 Feb 4 15:49 modules
-rw-r--r-- 1 root root 767 Feb 4 15:49 package.json
-rw-r--r-- 1 root root 4558 Feb 4 15:49 README.md
drwxr-xr-x 2 root root 4096 Feb 4 15:49 rpm
drwxr-xr-x 2 root root 4096 Feb 4 15:49 samples
drwxr-xr-x 2 root root 4096 Feb 4 15:49 src
drwxr-xr-x 7 root root 4096 Feb 4 15:49 tests
-rw-r--r-- 1 root root 3093 Feb 4 15:49 .travis.yml
output for ls -al /usr/local/bin (where i execute in php)
total 37744
drwxr-xr-x. 2 root root 4096 Feb 4 22:08 .
drwxr-xr-x. 11 root root 4096 Feb 2 00:49 ..
lrwxrwxrwx 1 root root 27 Feb 4 22:08 casperjs -> /root/casperjs/bin/ca sperjs
-rwxr-xr-x 1 root root 38641084 Feb 4 15:48 phantomjs
Another one of my own questions answered by myself I am happy that I am starting to understand this new Hobby :)
well any way luckily I am using virtual box whilst developing my server to my needs and every time I complete a task
like install Zpanel configure it I create a clone.
so what I done is I reverted back to my server set up before the PhantomJS and CasperJS.
I then installed both PhantomJS and CasperJS using the following methods and then used my test.php script to test
server functionality
Okay I used the following to install PhantomJS
# wget https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-1.9.7-linux-i686.tar.bz2
# tar xvf phantomjs-1.9.1-linux-i686.tar.bz2
# cp phantomjs-1.9.1-linux-i686/bin/phantomjs /usr/local/bin
Then I use these Commands For CasperJS install
# cd /opt
# wget https://codeload.github.com/n1k0/casperjs/legacy.zip/1.1-beta3
# unzip 1.1-beta3
# ln -s n1k0-casperjs-4f105a9/ casperjs
# ln -s /opt/casperjs/bin/casperjs /usr/local/bin/
I then created this on my server
PHP Test File Test.php
<?php
## This Function Below Sets PhantomJs So CasperJS Can Use It
putenv("PHANTOMJS_EXECUTABLE=/usr/local/bin/phantomjs");
echo "Running PhantomJS version: ";
echo exec('/usr/local/bin/phantomjs --version 2>&1');
echo "<br />";
echo "Running CasperJS version: ";
echo exec('/usr/local/bin/casperjs --version 2>&1');
?>
After this I ran Test.php And got this result
Running PhantomJS version: 1.9.7
Running CasperJS version: 1.1.0-beta3
My Server Now Runs CasperJs With PhantomJS
Please Uprate This Answer if you like it :)