with the latest version of npm but i cant install compiler successfully.
ash#ubuntu:~/inbox$ node -v
v8.11.1
ash#ubuntu:~/inbox$ npm -v
5.8.0
ash#ubuntu:~/inbox$ sudo npm install --save solc
npm WARN saveError ENOENT: no such file or directory, open '/home/ash/inbox/package.json'
npm WARN enoent ENOENT: no such file or directory, open '/home/ash/inbox/package.json'
npm WARN webpack-cli#2.0.14 requires a peer of webpack#^4.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN inbox No description
npm WARN inbox No repository field.
npm WARN inbox No README data
npm WARN inbox No license field.
+ solc#0.4.21
updated 1 package in 5.593s
ash#ubuntu:~/inbox$
enter image description here
You're attempting to install into a project directory which will try to update the project's package.json file to add the dependency. The install still worked. You will find it under node_modules/solc.
The better approach is to install it globally:
npm install -g solc
I have installed node.js v8.6.0 and i'm trying to run v.4.4.3 developed npm module. It created problem like this:
$ yo angular-scalatra
+-+-+-+-+-+-+-+ +-+-+-+-+-+-+-+-+ +-+-+-+-+-+-+-+-+-+
|a|n|g|u|l|a|r| |s|c|a|l|a|t|r|a| |g|e|n|e|r|a|t|o|r|
+-+-+-+-+-+-+-+ +-+-+-+-+-+-+-+-+ +-+-+-+-+-+-+-+-+-+
[?] What is the name of your application? myapp
[?] What is your default package name? com.mycompany.myapp
create generator.json
create package.json
create bower.json
identical .bowerrc
create Gruntfile.js
identical .gitignore
create sbt
create assembly.sbt
create project/build.properties
create project/build.scala
create project/plugins.sbt
create src/main/resources/logback.xml
create src/main/scala/JettyLauncher.scala
create src/main/scala/ScalatraBootstrap.scala
create src/main/scala/com/mycompany/myapp/data/DatabaseInit.scala
create src/main/scala/com/mycompany/myapp/json/DateSerializer.scala
create src/main/scala/com/mycompany/myapp/data/DatabaseSessionSupport.scala
create src/main/scala/com/mycompany/myapp/models/ScalatraRecord.scala
create src/main/webapp/WEB-INF/web.xml
create src/main/webapp/index.html
create src/main/webapp/css/app.css
create src/main/webapp/js/app.js
create src/main/webapp/js/home/home-controller.js
create src/main/webapp/views/home/home.html
identical .editorconfig
identical .jshintrc
I'm all done. Running bower install & npm install for you to install the required dependencies. If this fails, try running the command yourself.
npm WARN deprecated grunt-ngmin#0.0.3: use grunt-ng-annotate instead
npm WARN deprecated bower#1.2.8: ...psst! Your project can stop working at any moment because its dependencies can change. Prevent this by migrating to Yarn: https://bower.io/blog/2017/how-to-migrate-away-from-bower/
npm WARN deprecated connect#2.7.11: connect 2.x series is deprecated
npm WARN deprecated minimatch#0.2.14: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated ngmin#0.4.1: use ng-annotate instead
npm WARN deprecated graceful-fs#2.0.3: graceful-fs v3.0.0 and before will fail on node releases >= v7.0. Please update to graceful-fs#^4.0.0 as soon as possible. Use 'npm ls graceful-fs' to find it in the tree.
npm WARN deprecated graceful-fs#1.2.3: graceful-fs v3.0.0 and before will fail on node releases >= v7.0. Please update to graceful-fs#^4.0.0 as soon as possible. Use 'npm ls graceful-fs' to find it in the tree.
npm WARN deprecated connect#2.8.8: connect 2.x series is deprecated
npm WARN deprecated minimatch#0.4.0: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated node-uuid#1.4.8: Use uuid module instead
npm WARN deprecated minimatch#0.3.0: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated find-file#0.1.4: Use the globby package instead
> ws#0.4.32 install /home/limitless/Documents/projects/test/scala/myapp/node_modules/ws
> (node-gyp rebuild 2> builderror.log) || (exit 0)
make: Entering directory '/home/limitless/Documents/projects/test/scala/myapp/node_modules/ws/build'
CXX(target) Release/obj.target/bufferutil/src/bufferutil.o
bufferutil.target.mk:97: recipe for target 'Release/obj.target/bufferutil/src/bufferutil.o' failed
make: Leaving directory '/home/limitless/Documents/projects/test/scala/myapp/node_modules/ws/build'
> gifsicle#0.1.7 postinstall /home/limitless/Documents/projects/test/scala/myapp/node_modules/gifsicle
> node index.js
path.js:28
throw new TypeError('Path must be a string. Received ' + inspect(path));
^
TypeError: Path must be a string. Received { url: 'https://raw.github.com/imagemin/gifsicle-bin/v0.1.7/vendor/linux/x64/gifsicle',
name: 'gifsicle',
os: 'linux',
arch: 'x64' }
at assertPath (path.js:28:11)
at Object.basename (path.js:1397:5)
at /home/limitless/Documents/projects/test/scala/myapp/node_modules/download/index.js:35:43
at each (/home/limitless/Documents/projects/test/scala/myapp/node_modules/each-async/each-async.js:63:4)
at module.exports (/home/limitless/Documents/projects/test/scala/myapp/node_modules/download/index.js:33:5)
at /home/limitless/Documents/projects/test/scala/myapp/node_modules/bin-wrapper/index.js:108:20
at /home/limitless/Documents/projects/test/scala/myapp/node_modules/bin-wrapper/index.js:141:24
at /home/limitless/Documents/projects/test/scala/myapp/node_modules/bin-check/index.js:30:20
at /home/limitless/Documents/projects/test/scala/myapp/node_modules/executable/index.js:39:20
at FSReqWrap.oncomplete (fs.js:153:21)
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#github:pipobscure/fsevents#7dcdf9fa3f8956610fd6f69f72c67bace2de7138 (node_modules/chokidar/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#0.2.1: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN karma#0.10.10 requires a peer of karma-requirejs#~0.2.0 but none is installed. You must install peer dependencies yourself.
npm WARN karma#0.10.10 requires a peer of karma-coffee-preprocessor#~0.1.0 but none is installed. You must install peer dependencies yourself.
npm WARN karma#0.10.10 requires a peer of karma-html2js-preprocessor#~0.1.0 but none is installed. You must install peer dependencies yourself.
npm WARN karma#0.10.10 requires a peer of karma-chrome-launcher#~0.1.0 but none is installed. You must install peer dependencies yourself.
npm WARN karma#0.10.10 requires a peer of karma-firefox-launcher#~0.1.0 but none is installed. You must install peer dependencies yourself.
npm WARN karma#0.10.10 requires a peer of karma-phantomjs-launcher#~0.1.0 but none is installed. You must install peer dependencies yourself.
npm WARN karma#0.10.10 requires a peer of karma-script-launcher#~0.1.0 but none is installed. You must install peer dependencies yourself.
npm WARN myapp#0.0.0 No repository field.
npm WARN myapp#0.0.0 No license field.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! gifsicle#0.1.7 postinstall: `node index.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the gifsicle#0.1.7 postinstall 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! /home/limitless/.npm/_logs/2017-10-16T16_19_21_976Z-debug.log
So i'm not able to run application. Can you help me to resolve this problem?
the solution is n first install typing
npm install -g n
and then install with
sudo n 4.4.3
this install will set your node js version to use in the system
The error message says that "Path must be a string", and shows that the path it received is an object, not a string.
Perhaps you should be using path.url instead of path?
(Just guessing. You should show the relevant code when you ask these types of questions.)
I resolved issue installation of nvm(Node Version Manager) and V4.4.3 node.js
1) To install nvm
curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.5/install.sh | bash
2) if installation is done then open new terminal and list what version of node installed.
nvm ls
nvm ls
-> system
node -> stable (-> N/A) (default)
iojs -> N/A (default)
3) Install node.js which version you want ex.V4.4.3
nvm install v4.4.3
4) set default version of node.js
nvm alias default v4.4.3
5) run your application
$ yo angular-scalatra
+-+-+-+-+-+-+-+ +-+-+-+-+-+-+-+-+ +-+-+-+-+-+-+-+-+-+
|a|n|g|u|l|a|r| |s|c|a|l|a|t|r|a| |g|e|n|e|r|a|t|o|r|
+-+-+-+-+-+-+-+ +-+-+-+-+-+-+-+-+ +-+-+-+-+-+-+-+-+-+
[?] What is the name of your application? myapp
[?] What is your default package name? com.mycompany.myapp
create generator.json
create package.json
create bower.json
identical .bowerrc
create Gruntfile.js
identical .gitignore
create sbt
create assembly.sbt
create project/build.properties
create project/build.scala
create project/plugins.sbt
create src/main/resources/logback.xml
create src/main/scala/JettyLauncher.scala
create src/main/scala/ScalatraBootstrap.scala
create src/main/scala/com/mycompany/myapp/data/DatabaseInit.scala
create src/main/scala/com/mycompany/myapp/json/DateSerializer.scala
create src/main/scala/com/mycompany/myapp/data/DatabaseSessionSupport.scala
create src/main/scala/com/mycompany/myapp/models/ScalatraRecord.scala
create src/main/webapp/WEB-INF/web.xml
create src/main/webapp/index.html
create src/main/webapp/css/app.css
create src/main/webapp/js/app.js
create src/main/webapp/js/home/home-controller.js
create src/main/webapp/views/home/home.html
identical .editorconfig
identical .jshintrc
I'm all done. Running bower install & npm install for you to install the required dependencies. If this fails, try running the command yourself.
npm WARN package.json myapp#0.0.0 No repository field.
npm WARN package.json myapp#0.0.0 No README data
npm WARN package.json myapp#0.0.0 No license field.
npm WARN deprecated grunt-ngmin#0.0.3: use grunt-ng-annotate instead
npm WARN engine karma#0.10.10: wanted: {"node":"~0.8 || ~0.10"} (current: {"node":"4.4.3","npm":"2.15.1"})
npm WARN deprecated ngmin#0.4.1: use ng-annotate instead
npm WARN deprecated bower#1.2.8: ...psst! Your project can stop working at any moment because its dependencies can change. Prevent this by migrating to Yarn: https://bower.io/blog/2017/how-to-migrate-away-from-bower/
npm WARN deprecated connect#2.7.11: connect 2.x series is deprecated
npm WARN deprecated minimatch#0.2.14: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN peerDependencies The peer dependency karma-requirejs#~0.2.0 included from karma will no
npm WARN peerDependencies longer be automatically installed to fulfill the peerDependency
npm WARN peerDependencies in npm 3+. Your application will need to depend on it explicitly.
npm WARN peerDependencies The peer dependency karma-coffee-preprocessor#~0.1.0 included from karma will no
npm WARN peerDependencies longer be automatically installed to fulfill the peerDependency
npm WARN peerDependencies in npm 3+. Your application will need to depend on it explicitly.
npm WARN peerDependencies The peer dependency karma-html2js-preprocessor#~0.1.0 included from karma will no
npm WARN peerDependencies longer be automatically installed to fulfill the peerDependency
npm WARN peerDependencies in npm 3+. Your application will need to depend on it explicitly.
npm WARN peerDependencies The peer dependency karma-chrome-launcher#~0.1.0 included from karma will no
npm WARN peerDependencies longer be automatically installed to fulfill the peerDependency
npm WARN peerDependencies in npm 3+. Your application will need to depend on it explicitly.
npm WARN peerDependencies The peer dependency karma-firefox-launcher#~0.1.0 included from karma will no
npm WARN peerDependencies longer be automatically installed to fulfill the peerDependency
npm WARN peerDependencies in npm 3+. Your application will need to depend on it explicitly.
npm WARN peerDependencies The peer dependency karma-phantomjs-launcher#~0.1.0 included from karma will no
npm WARN peerDependencies longer be automatically installed to fulfill the peerDependency
npm WARN peerDependencies in npm 3+. Your application will need to depend on it explicitly.
npm WARN peerDependencies The peer dependency karma-script-launcher#~0.1.0 included from karma will no
npm WARN peerDependencies longer be automatically installed to fulfill the peerDependency
npm WARN peerDependencies in npm 3+. Your application will need to depend on it explicitly.
npm WARN deprecated connect#2.8.8: connect 2.x series is deprecated
npm WARN deprecated graceful-fs#1.2.3: graceful-fs v3.0.0 and before will fail on node releases >= v7.0. Please update to graceful-fs#^4.0.0 as soon as possible. Use 'npm ls graceful-fs' to find it in the tree.
npm WARN deprecated find-file#0.1.4: Use the globby package instead
npm WARN deprecated minimatch#0.3.0: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated graceful-fs#2.0.3: graceful-fs v3.0.0 and before will fail on node releases >= v7.0. Please update to graceful-fs#^4.0.0 as soon as possible. Use 'npm ls graceful-fs' to find it in the tree.
npm WARN deprecated minimatch#0.4.0: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
> grunt-autoprefixer#0.4.2 postinstall /home/limitless/Documents/projects/test/scala/myapp/node_modules/grunt-autoprefixer
>
npm WARN engine hawk#6.0.2: wanted: {"node":">=4.5.0"} (current: {"node":"4.4.3","npm":"2.15.1"})
npm WARN engine hawk#6.0.2: wanted: {"node":">=4.5.0"} (current: {"node":"4.4.3","npm":"2.15.1"})
npm WARN engine hawk#6.0.2: wanted: {"node":">=4.5.0"} (current: {"node":"4.4.3","npm":"2.15.1"})
npm WARN engine hawk#6.0.2: wanted: {"node":">=4.5.0"} (current: {"node":"4.4.3","npm":"2.15.1"})
npm WARN engine hawk#6.0.2: wanted: {"node":">=4.5.0"} (current: {"node":"4.4.3","npm":"2.15.1"})
npm WARN engine hawk#6.0.2: wanted: {"node":">=4.5.0"} (current: {"node":"4.4.3","npm":"2.15.1"})
npm WARN engine hawk#6.0.2: wanted: {"node":">=4.5.0"} (current: {"node":"4.4.3","npm":"2.15.1"})
npm WARN engine hawk#6.0.2: wanted: {"node":">=4.5.0"} (current: {"node":"4.4.3","npm":"2.15.1"})
npm WARN optional dep failed, continuing fsevents#0.2.1
npm WARN deprecated node-uuid#1.4.8: Use uuid module instead
> pngquant-bin#0.1.7 postinstall /home/limitless/Documents/projects/test/scala/myapp/node_modules/grunt-contrib-imagemin/node_modules/pngquant-bin
> node index.js
✓ pre-build test passed successfully
> optipng-bin#0.3.11 postinstall /home/limitless/Documents/projects/test/scala/myapp/node_modules/grunt-contrib-imagemin/node_modules/optipng-bin
> node index.js
✔ pre-build test passed successfully!
> jpegtran-bin#0.2.8 postinstall /home/limitless/Documents/projects/test/scala/myapp/node_modules/grunt-contrib-imagemin/node_modules/jpegtran-bin
> node index.js
✔ pre-build test passed successfully!
> gifsicle#0.1.7 postinstall /home/limitless/Documents/projects/test/scala/myapp/node_modules/grunt-contrib-imagemin/node_modules/gifsicle
> node index.js
✔ pre-build test passed successfully!
> ws#0.4.32 install /home/limitless/Documents/projects/test/scala/myapp/node_modules/karma/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws
> (node-gyp rebuild 2> builderror.log) || (exit 0)
make: Entering directory '/home/limitless/Documents/projects/test/scala/myapp/node_modules/karma/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/build'
CXX(target) Release/obj.target/bufferutil/src/bufferutil.o
bufferutil.target.mk:92: recipe for target 'Release/obj.target/bufferutil/src/bufferutil.o' failed
make: Leaving directory '/home/limitless/Documents/projects/test/scala/myapp/node_modules/karma/node_modules/socket.io/node_modules/socket.io-client/node_modules/ws/build'
npm WARN peerDependencies The peer dependency requirejs#^2.1.0 included from karma-requirejs will no
npm WARN peerDependencies longer be automatically installed to fulfill the peerDependency
npm WARN peerDependencies in npm 3+. Your application will need to depend on it explicitly.
npm WARN deprecated tough-cookie#2.2.2: ReDoS vulnerability parsing Set-Cookie https://nodesecurity.io/advisories/130
/
> phantomjs#1.9.20 install /home/limitless/Documents/projects/test/scala/myapp/node_modules/karma-phantomjs-launcher/node_modules/phantomjs
> node install.js
PhantomJS not found on PATH
Downloading https://github.com/Medium/phantomjs/releases/download/v1.9.19/phantomjs-1.9.8-linux-x86_64.tar.bz2
Saving to /tmp/phantomjs/phantomjs-1.9.8-linux-x86_64.tar.bz2
Receiving...
[========================================] 99%
Received 12854K total.
Extracting tar contents (via spawned process)
Removing /home/limitless/Documents/projects/test/scala/myapp/node_modules/karma-phantomjs-launcher/node_modules/phantomjs/lib/phantom
Copying extracted folder /tmp/phantomjs/phantomjs-1.9.8-linux-x86_64.tar.bz2-extract-1508170953450/phantomjs-1.9.8-linux-x86_64 -> /home/limitless/Documents/projects/test/scala/myapp/node_modules/karma-phantomjs-launcher/node_modules/phantomjs/lib/phantom
Writing location.js file
Done. Phantomjs binary available at /home/limitless/Documents/projects/test/scala/myapp/node_modules/karma-phantomjs-launcher/node_modules/phantomjs/lib/phantom/bin/phantomjs
karma-jasmine#0.1.6 node_modules/karma-jasmine
grunt-rev#0.1.0 node_modules/grunt-rev
karma-ng-scenario#0.1.0 node_modules/karma-ng-scenario
grunt-contrib-concat#0.3.0 node_modules/grunt-contrib-concat
grunt-contrib-copy#0.4.1 node_modules/grunt-contrib-copy
karma-junit-reporter#0.1.0 node_modules/karma-junit-reporter
└── xmlbuilder#0.4.2
grunt-contrib-clean#0.5.0 node_modules/grunt-contrib-clean
└── rimraf#2.2.8
grunt-sync#0.0.8 node_modules/grunt-sync
└── promised-io#0.3.3
grunt-concurrent#0.4.3 node_modules/grunt-concurrent
├── lpad#0.1.0
└── async#0.2.10
time-grunt#0.2.3 node_modules/time-grunt
├── ms#0.6.2
├── hooker#0.2.3
├── text-table#0.2.0
└── chalk#0.3.0 (has-color#0.1.7, ansi-styles#0.2.0)
grunt-contrib-htmlmin#0.1.3 node_modules/grunt-contrib-htmlmin
├── html-minifier#0.5.6
└── grunt-lib-contrib#0.6.1 (zlib-browserify#0.0.1)
grunt-connect-proxy#0.2.0 node_modules/grunt-connect-proxy
├── lodash#0.9.2
└── http-proxy#1.11.3 (eventemitter3#1.2.0, requires-port#0.0.1)
grunt-contrib-cssmin#0.7.0 node_modules/grunt-contrib-cssmin
├── grunt-lib-contrib#0.6.1 (zlib-browserify#0.0.1)
└── clean-css#2.0.8 (commander#2.0.0)
grunt-karma#0.6.2 node_modules/grunt-karma
└── optimist#0.6.1 (wordwrap#0.0.3, minimist#0.0.10)
grunt-usemin#2.0.2 node_modules/grunt-usemin
├── debug#0.7.4
└── lodash#1.0.2
load-grunt-tasks#0.2.1 node_modules/load-grunt-tasks
├── globule#0.1.0 (lodash#1.0.2, glob#3.1.21, minimatch#0.2.14)
└── findup-sync#0.1.3 (lodash#2.4.2, glob#3.2.11)
grunt-svgmin#0.3.1 node_modules/grunt-svgmin
├── each-async#0.1.3
├── pretty-bytes#0.1.2
├── chalk#0.4.0 (has-color#0.1.7, ansi-styles#1.0.0, strip-ansi#0.1.1)
└── svgo#0.4.5 (colors#0.6.2, whet.extend#0.9.9, sax#0.6.1, coa#0.4.1, js-yaml#2.1.3)
grunt-autoprefixer#0.4.2 node_modules/grunt-autoprefixer
└── autoprefixer#0.8.20131213 (css-parse#1.6.0, css-stringify#1.4.1)
grunt-contrib-connect#0.5.0 node_modules/grunt-contrib-connect
├── connect-livereload#0.2.0
├── open#0.0.4
└── connect#2.7.11 (fresh#0.1.0, qs#0.6.5, pause#0.0.1, cookie-signature#1.0.1, buffer-crc32#0.2.1, bytes#0.2.0, cookie#0.0.5, formidable#1.0.14, debug#3.1.0, send#0.1.1)
grunt-contrib-watch#0.5.3 node_modules/grunt-contrib-watch
├── gaze#0.4.3 (globule#0.1.0)
└── tiny-lr#0.0.4 (debug#0.7.4, qs#0.5.6, faye-websocket#0.4.4, noptify#0.0.3)
grunt-bower-install#0.7.0 node_modules/grunt-bower-install
└── wiredep#0.4.2 (chalk#0.1.1, lodash#1.3.1)
grunt-contrib-uglify#0.2.7 node_modules/grunt-contrib-uglify
├── grunt-lib-contrib#0.6.1 (zlib-browserify#0.0.1)
└── uglify-js#2.4.24 (async#0.2.10, uglify-to-browserify#1.0.2, yargs#3.5.4, source-map#0.1.34)
grunt-ngmin#0.0.3 node_modules/grunt-ngmin
└── ngmin#0.4.1 (astral#0.1.0, clone#0.1.19, esprima#1.0.4, commander#1.1.1, astral-angular-annotate#0.0.2, escodegen#0.0.28)
grunt-contrib-jshint#0.7.2 node_modules/grunt-contrib-jshint
└── jshint#2.3.0 (console-browserify#0.1.6, underscore#1.4.4, minimatch#0.4.0, shelljs#0.1.4, cli#0.4.5)
grunt#0.4.5 node_modules/grunt
├── eventemitter2#0.4.14
├── dateformat#1.0.2-1.2.3
├── which#1.0.9
├── getobject#0.1.0
├── async#0.1.22
├── colors#0.6.2
├── lodash#0.9.2
├── rimraf#2.2.8
├── hooker#0.2.3
├── grunt-legacy-util#0.2.0
├── exit#0.1.2
├── nopt#1.0.10 (abbrev#1.1.1)
├── coffee-script#1.3.3
├── iconv-lite#0.2.11
├── underscore.string#2.2.1
├── glob#3.1.21 (inherits#1.0.2, graceful-fs#1.2.3)
├── minimatch#0.2.14 (sigmund#1.0.1, lru-cache#2.7.3)
├── grunt-legacy-log#0.1.3 (grunt-legacy-log-utils#0.1.1, lodash#2.4.2, underscore.string#2.3.3)
├── findup-sync#0.1.3 (lodash#2.4.2, glob#3.2.11)
└── js-yaml#2.0.5 (esprima#1.0.4, argparse#0.1.16)
grunt-modernizr#0.4.1 node_modules/grunt-modernizr
├── colors#0.6.2
├── promised-io#0.3.5
├── uglify-js#1.3.3
└── request#2.27.0 (aws-sign#0.3.0, forever-agent#0.5.2, tunnel-agent#0.3.0, qs#0.6.6, oauth-sign#0.3.0, mime#1.2.11, json-stringify-safe#5.0.1, cookie-jar#0.3.0, node-uuid#1.4.8, http-signature#0.10.1, hawk#1.0.0, form-data#0.1.4)
grunt-bowercopy#0.4.1 node_modules/grunt-bowercopy
├── lodash#2.4.2
└── bower#1.2.8 (stringify-object#0.1.8, junk#0.2.2, abbrev#1.0.9, which#1.0.9, osenv#0.0.3, graceful-fs#2.0.3, open#0.0.5, nopt#2.1.2, bower-endpoint-parser#0.2.2, chmodr#0.1.2, bower-logger#0.2.2, archy#0.0.2, p-throttler#0.0.1, q#0.9.7, rimraf#2.2.8, lru-cache#2.3.1, retry#0.6.1, semver#2.1.0, chalk#0.2.1, mkdirp#0.3.5, tmp#0.0.33, sudo-block#0.2.1, request-progress#0.3.1, bower-json#0.4.0, glob#3.2.11, fstream-ignore#0.0.10, tar#0.1.20, promptly#0.2.1, fstream#0.1.31, cardinal#0.4.4, request#2.27.0, decompress-zip#0.0.8, handlebars#1.0.12, inquirer#0.3.5, mout#0.7.1, bower-config#0.5.3, update-notifier#0.1.10, bower-registry-client#0.1.6)
grunt-contrib-imagemin#0.4.1 node_modules/grunt-contrib-imagemin
├── filesize#2.0.4
├── async#0.2.10
├── chalk#0.4.0 (has-color#0.1.7, ansi-styles#1.0.0, strip-ansi#0.1.1)
├── pngquant-bin#0.1.7 (bin-wrapper#0.2.4)
├── optipng-bin#0.3.11 (log-symbols#1.0.2, bin-wrapper#0.3.4, bin-build#0.1.1)
├── jpegtran-bin#0.2.8 (log-symbols#1.0.2, bin-wrapper#0.3.4, bin-build#0.1.1)
└── gifsicle#0.1.7 (log-symbols#1.0.2, bin-wrapper#0.3.4, bin-build#0.1.1)
karma-script-launcher#0.1.0 node_modules/karma-script-launcher
karma-firefox-launcher#0.1.7 node_modules/karma-firefox-launcher
karma-html2js-preprocessor#0.1.0 node_modules/karma-html2js-preprocessor
karma-chrome-launcher#0.1.12 node_modules/karma-chrome-launcher
└── which#1.3.0 (isexe#2.0.0)
karma-coffee-preprocessor#0.1.3 node_modules/karma-coffee-preprocessor
└── coffee-script#1.7.1 (mkdirp#0.3.5)
requirejs#2.3.5 node_modules/requirejs
karma-requirejs#0.2.6 node_modules/karma-requirejs
karma-phantomjs-launcher#0.1.4 node_modules/karma-phantomjs-launcher
└── phantomjs#1.9.20 (progress#1.1.8, kew#0.7.0, which#1.2.14, request-progress#2.0.1, hasha#2.2.0, extract-zip#1.5.0, fs-extra#0.26.7, request#2.67.0)
karma#0.10.10 node_modules/karma
├── colors#0.6.0-1
├── di#0.0.1
├── graceful-fs#1.2.3
├── mime#1.2.11
├── rimraf#2.1.4
├── q#0.9.7
├── lodash#1.1.1
├── coffee-script#1.6.3
├── minimatch#0.2.14 (sigmund#1.0.1, lru-cache#2.7.3)
├── glob#3.1.21 (inherits#1.0.2)
├── optimist#0.3.7 (wordwrap#0.0.3)
├── useragent#2.0.10 (lru-cache#2.2.4)
├── log4js#0.6.38 (semver#4.3.6, readable-stream#1.0.34)
├── chokidar#0.8.4 (recursive-readdir#0.0.2)
├── connect#2.8.8 (methods#0.0.1, uid2#0.0.2, qs#0.6.5, cookie-signature#1.0.1, pause#0.0.1, buffer-crc32#0.2.1, bytes#0.2.0, fresh#0.2.0, cookie#0.1.0, send#0.1.4, debug#3.1.0, formidable#1.0.14)
├── http-proxy#0.10.4 (colors#0.6.2, pkginfo#0.3.1, optimist#0.6.1, utile#0.2.1)
└── socket.io#0.9.19 (base64id#0.1.0, policyfile#0.0.4, redis#0.7.3, socket.io-client#0.9.16)
I am trying to make use of React-Native-Web, but the master branch version of ListView gives the error: TypeError: undefined is not a constructor (evaluating 'new _reactNative.ListView.DataSource')
One of the pull requests on the project adds the ListView functionality I need.
How do I add this PR to my own project?
What I have tried:
created my own fork and manually added the files then tried to use npm to load it directly as per this SO question, it did not work, key core components were missing. The way one normally installs React-Native-Web is npm install --save react#0.14 react-dom#0.14 react-native-web and I tried npm install https:https://github.com/mcampsall/react-native-web
adding the files directly to my /dist folder. This did not work because I needed the babel translated versions of the files. I tried to use the babel REPL to translate them, but it is missing some plugins and gets hung up on certain parts of the code.
Thanks in advance.
EDIT: I just tried npm install --save react#0.14 react-dom#0.14 https://github.com/mcampsall/react-native-web as per Molda's suggestion and got:
├── babel#6.5.2 extraneous
├── babel-plugin-transform-decorators#6.8.0
├── babel-plugin-transform-decorators-legacy#1.3.4
├── babel-preset-react#6.5.0
├── UNMET PEER DEPENDENCY react#0.14.8
├── UNMET PEER DEPENDENCY react-dom#0.14.8
└─┬ react-native-web#0.0.25 (git+https://github.com/mcampsall/react-native-web.git#b448fb94cb29d08057eb72e4c13d09ad808f719a)
├─┬ fbjs#0.8.3
│ └── object-assign#4.1.0
└── react-textarea-autosize#4.0.3
npm WARN react-native-web#0.0.25 requires a peer of react#^15.1.0 but none was installed.
npm WARN react-native-web#0.0.25 requires a peer of react-dom#^15.1.0 but none was installed.
EDIT 2: tried npm install --save react#15.1.0 react-dom#15.1.0 https://github.com/mcampsall/react-native-web and when i do this i get an error npm WARN react-native#0.23.1 requires a peer of react#^0.14.5 but none was installed. which is a different version of react-native-web(0.23.1) than the original error (which was 0.25)...?
I then tried installing react#14.5 and it showed the original error again npm WARN react-native-web#0.0.25 requires a peer of react#^15.1.0 but none was installed.
I just tried this
npm install --save react#15.1.0 react-dom#15.1.0 git+https://git#github.com/mcampsall/react-native-web
and it installs without any error.
Make sure you delete all the packages before you install again or try to install into new empty folder
Error: Cannot find module 'underscore' thrown in console for all Meteor commands
After every meteor or meteorite command such as meteor or mrt create myapp the following error is thrown. This error seemed to appear suddenly, as meteor was functional the night before and no changes have been made since.
Austins-MacBook-Pro:Projects austinrivas$ mrt create test-app
/Users/austinrivas/.meteor/tools/3cba50c44a/tools/meteor.js:1480
}).run();
^
Error: Cannot find module 'underscore'
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 /Users/austinrivas/.meteor/tools/3cba50c44a/tools/meteor.js:10:11
I have tried installing underscore manually with sudo npm install -g underscore which returns
Austins-MacBook-Pro:Projects austinrivas$ sudo npm install -g underscore
Password:
npm http GET https://registry.npmjs.org/underscore
npm http 200 https://registry.npmjs.org/underscore
npm http GET https://registry.npmjs.org/underscore/-/underscore-1.5.2.tgz
npm http 200 https://registry.npmjs.org/underscore/-/underscore-1.5.2.tgz
npm WARN unmet dependency /usr/local/share/npm/lib/node_modules/phonegap/node_modules/cordova requires colors#'>=0.6.0' but will load
npm WARN unmet dependency /usr/local/share/npm/lib/node_modules/phonegap/node_modules/colors,
npm WARN unmet dependency which is version 0.6.0-1
npm WARN unmet dependency /usr/local/share/npm/lib/node_modules/phonegap/node_modules/node-static requires colors#'>=0.6.0' but will load
npm WARN unmet dependency /usr/local/share/npm/lib/node_modules/phonegap/node_modules/colors,
npm WARN unmet dependency which is version 0.6.0-1
underscore#1.5.2 /usr/local/share/npm/lib/node_modules/underscore
My ~/.bash_profile has the following paths
export PATH=/usr/local/share/npm/bin:$PATH
export NODE_PATH="/usr/local/share/npm/lib/node_modules"
export NODE_OPTIONS="--debug"
I've even tried reinstalling node and doing an npm cache clean but I'm not sure what else to try.
Any further insight would be appreciated.
UPDATE
Running npm list -g underscore returns the following
Austins-MacBook-Pro:~ austinrivas$ npm list -g underscore
npm WARN unmet dependency /usr/local/share/npm/lib/node_modules/phonegap/node_modules/cordova requires colors#'>=0.6.0' but will load
npm WARN unmet dependency /usr/local/share/npm/lib/node_modules/phonegap/node_modules/colors,
npm WARN unmet dependency which is version 0.6.0-1
npm WARN unmet dependency /usr/local/share/npm/lib/node_modules/phonegap/node_modules/node-static requires colors#'>=0.6.0' but will load
npm WARN unmet dependency /usr/local/share/npm/lib/node_modules/phonegap/node_modules/colors,
npm WARN unmet dependency which is version 0.6.0-1
/usr/local/share/npm/lib
├─┬ meteorite#0.6.11
│ ├─┬ ddp#0.3.4
│ │ └─┬ meteor-ejson#0.6.3
│ │ └── underscore#1.4.4
│ └── underscore#1.5.1
├─┬ phonegap#3.0.0-0.14.0
│ └─┬ cordova#3.0.0
│ ├─┬ follow-redirects#0.0.3
│ │ └── underscore#1.5.1
│ └─┬ plugman#0.9.10
│ ├─┬ dep-graph#1.1.0
│ │ └── underscore#1.2.1
│ └── underscore#1.4.4
├── underscore#1.5.2
└─┬ ungit#0.1.8
└── underscore#1.4.4
I was able to resolve this error by completely uninstalling / reinstalling meteor and meteorite through the following steps.
sudo rm /usr/local/bin/meteor
rm -rf ~/.meteor
sudo mrt uninstall
sudo mrt uninstall --system
sudo chown -R `whoami` ~/.npm
curl https://install.meteor.com | /bin/sh
sudo -H npm install -g meteorite
I was able to verifying everything was working properly by running meteor --version and mrt create test-app
First off, your meteorite is out of date. To update meteorite run (sudo if applicable):
npm update -g meteorite
If you ran the 'mrt' or 'meteor' command as sudo in the past, it will cause issues. Clear meteorite by running:
sudo mrt uninstall
sudo mrt uninstall --system
sudo chown -R `whoami` ~/.npm
You also want to remove the 'build' folder inside existing projects, located in '/project/.meteor/local/build'
In a node.js script that I'm working on, I want to print all node.js modules (installed using npm) to the command line. How can I do this?
console.log(__filename);
//now I want to print all installed modules to the command line. How can I do this?
If you are only interested in the packages installed globally without the full TREE then:
npm -g ls --depth=0
or locally (omit -g) :
npm ls --depth=0
Use npm ls (there is even json output)
From the script:
test.js:
function npmls(cb) {
require('child_process').exec('npm ls --json', function(err, stdout, stderr) {
if (err) return cb(err)
cb(null, JSON.parse(stdout));
});
}
npmls(console.log);
run:
> node test.js
null { name: 'x11', version: '0.0.11' }
list of all globally installed third party modules, write in console:
npm -g ls
in any os
npm -g list
and thats it
Generally, there are two ways to list out installed packages - through the Command Line Interface (CLI) or in your application using the API.
Both commands will print to stdout all the versions of packages that are installed, as well as their dependencies, in a tree-structure.
CLI
npm list
Use the -g (global) flag to list out all globally-installed packages. Use the --depth=0 flag to list out only the top packages and not their dependencies.
API
In your case, you want to run this within your script, so you'd need to use the API. From the docs:
npm.commands.ls(args, [silent,] callback)
In addition to printing to stdout, the data will also be passed into the callback.
Why not grab them from dependencies in package.json?
Of course, this will only give you the ones you actually saved, but you should be doing that anyway.
console.log(Object.keys(require('./package.json').dependencies));
for package in `sudo npm -g ls --depth=0 --parseable`; do
printf "${package##*/}\n";
done
As the end of 2021, there are few obvious way to do it, and a part as the only one give on the answer above this is a complete list.
The Node.js Documentation is actually pretty well explained regarding the matter, this is a collective list of the main commands.
All Commands will run the list of installed modules Locally. In order to run global level just add a -g flag at the end of the statement.
See the version of all installed npm packages, including their dependencies.
❯ npm list
>>> /Users/joe/dev/node/cowsay
└─┬ cowsay#1.3.1
├── get-stdin#5.0.1
├─┬ optimist#0.6.1
│ ├── minimist#0.0.10
│ └── wordwrap#0.0.3
├─┬ string-width#2.1.1
│ ├── is-fullwidth-code-point#2.0.0
│ └─┬ strip-ansi#4.0.0
│ └── ansi-regex#3.0.0
└── strip-eof#1.0.0
Get only your top-level packages
npm list --depth=0
Get the version of a specific package by specifying its name.
npm list <package-name>
See what's the latest available version of the package on the npm repository
npm view <package-name> version
Install an old version of an npm package using the # syntax
npm install #
npm install cowsay#1.2.0
Global package
npm install -g webpack#4.16.4
Listing all the previous versions of a package
npm view cowsay versions
[ '1.0.0',
'1.0.1',
'1.0.2',
'1.0.3',
'1.1.0',
'1.1.1',
'1.1.2',
'1.1.3',
....
]
Update all the Node.js dependencies
Install new minor or patch release
npm update
Install new minor or patch release but not update package.json
npm update --no-save
To discover new releases of the packages, this gives you the list of a few outdated packages in one repository that wasn't updated for quite a while
npm outdated
Some of those updates are major releases. Running npm update won't update the version of those. Major releases are never updated in this way because they (by definition) introduce breaking changes, and npm wants to save you trouble.
To update all packages to a new major version, install the npm-check-updates package globally:
npm install -g npm-check-updates
ncu -u
This will upgrade all the version hints in the package.json file, to dependencies and devDependencies, so npm can install the new major version
Dev Dependency
Install in development dependencies.
npm install <package-name> -D
npm install <package-name> --save-dev # same as above
Avoid installing those development dependencies in Production with
npm install --production
Uninstalling npm packages
npm uninstall <package-name>
npm uninstall -g <package-name> # globally uninstall
Uninstall a package and ** remove the reference in the package.json**
npm uninstall <package-name> -S
npm uninstall <package-name> --save # same as above
Some commands with global flag examples.
npm list -g
npm list --depth=0 -g
npm list <package-name> -g
npm view <package-name> version -g
Additional Commands
Answer by #prosti
Documentation
Find the installed version of an npm package
Install an older version of an npm package
Update all the Node.js dependencies to their latest version
Semantic Versioning using npm
Uninstalling npm packages
npm global or local packages
npm dependencies and devDependencies
The npx Node.js Package RunnerTABLE OF CONTENTS