npm install Giving error when Moving Project to Another Directory - node.js

I have a node project running in a directory, and I simply want to move it to another directory, let's say. When I try that, of course without the node_modules folder, and try to run npm install; it gives this error:
npm ERR! addLocal Could not install /Users/me_here
npm ERR! Darwin 15.3.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install"
npm ERR! node v5.8.0
npm ERR! npm v3.7.3
npm ERR! No version provided in package.json
My package.json is as follows:
{
"name": "my-amazing-title",
"version": "1.0.0",
"description": "an amazing description",
"main": "app.js",
"scripts": {
"start": "node app.js"
},
"author": "My full name",
"license": "MIT",
"dependencies": {
"express": "3.3.5",
"express-react-views": "file:../../",
"js-md5": "^0.4.0",
"react": "^0.14.0",
"react-dom": "^0.14.0",
"request": "^2.69.0",
"webpack": "^1.12.14"
}
}

I was able to npm install with your package.json by changing this line:
"express-react-views": "file:../../",
to
"express-react-views": "~0.10.0", //the current version at date of posting

Related

Google Cloud: Create A Simple Application With the API samples npm install failed

Following the instruction from here, https://cloud.google.com/bigquery/create-simple-app-api
cd to the samples folder
https://github.com/googleapis/nodejs-bigquery/tree/master/samples
The package.json is
https://github.com/googleapis/nodejs-bigquery/blob/master/samples/package.json
{
"name": "nodejs-docs-samples-bigquery",
"version": "0.0.1",
"private": true,
"license": "Apache-2.0",
"author": "Google LLC",
"repository": "googleapis/nodejs-bigquery",
"engines": {
"node": ">=4"
},
"scripts": {
"test": "repo-tools test run --cmd npm -- run cover",
"ava": "ava -T 3m --verbose test/*.test.js system-test/*.test.js",
"cover": "nyc --reporter=lcov --cache ava -T 3m --verbose test/*.test.js system-test/*.test.js && nyc report"
},
"dependencies": {
"#google-cloud/bigquery": "1.2.0",
"#google-cloud/storage": "1.5.1",
"yargs": "10.0.3"
},
"devDependencies": {
"#google-cloud/nodejs-repo-tools": "2.1.3",
"ava": "0.24.0",
"nyc": "11.3.0",
"proxyquire": "1.8.0",
"sinon": "4.1.3",
"uuid": "3.1.0"
}
}
I run
npm install
I get errors
Home-iMac:samples user1$ npm install
npm WARN #google-cloud/bigquery#1.2.0 had bundled packages that do not match the required version(s). They have been replaced with non-bundled versions.
npm ERR! path /Users/user1/project1/gcp/nodejs/bigquery_api/nodejs-bigquery-test/samples/node_modules/.staging/#google-cloud/bigquery-78ee5bef/node_modules/#sindresorhus/is
npm ERR! code ENOENT
npm ERR! errno -2
npm ERR! syscall rename
npm ERR! enoent ENOENT: no such file or directory, rename '/Users/user1/project1/gcp/nodejs/bigquery_api/nodejs-bigquery-test/samples/node_modules/.staging/#google-cloud/bigquery-78ee5bef/node_modules/#sindresorhus/is' -> '/Users/user1/project1/gcp/nodejs/bigquery_api/nodejs-bigquery-test/samples/node_modules/.staging/#sindresorhus/is-79439449'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/user1/.npm/_logs/2018-04-27T19_38_14_391Z-debug.log
To fix the error, a hack solution is instead of using the package.json to install, I have to run this manually first
npm install --save #google-cloud/bigquery
Then I can run
npm install
again. This time, it will finish without problem.
But I would like to be able to just simply using package.json, using npm install only to install the packages.
I changed the package.json
From
"#google-cloud/bigquery": "1.2.0",
to
"#google-cloud/bigquery": "^1.2.0",
It still does not work.
Thanks!
#Tim - Thanks for the request to update, #google/bigquery 1.3.0 is being used for the example. The download link to the GitHub site was updated, but the sample code on the page itself is not updated.

Npm prepublish script webpack not found

I am trying to modify a npm module and I want to include the modified module as a local dependency.
When deploying this app on hosting, I am facing a strange webpack not found problem. I managed to reproduce the problem in my local machine by removing webpack globally.
My package.json:
1) I try to include the local module in package.json dependencies:
{
"name": "parse-server-example",
"version": "1.4.0",
"description": "An example Parse API server using the parse-server module",
"main": "index.js",
"repository": {
"type": "git",
"url": "https://github.com/ParsePlatform/parse-server-example"
},
"license": "MIT",
"dependencies": {
"webpack": "2.3.3",
"express": "~4.11.x",
"kerberos": "~0.0.x",
"parse": "~1.8.0",
"parse-dashboard-simple": "./parse-dashboard-simple",
"parse-server": "*"
},
"scripts": {
"start": "node index.js"
},
"engines": {
"node": "7.6.0"
}
}
Take note that I have a local module called "./parse-dashboard-simple".
My local module's package.json:
{
"name": "parse-dashboard",
"parseDashboardFeatures": [
"Data Browser",
"Cloud Code Viewer",
"Cloud Code Jobs Viewer and Runner",
"Parse Config",
"API Console",
"Class Level Permissions Editor",
"Pointer Permissions Editor",
"Send Push Notifications",
"Logs Viewer",
"Push Status Page",
"Relation Editor"
],
"description": "The Parse Dashboard",
"keywords": [
"parse",
"dashboard"
],
"homepage": "https://github.com/ParsePlatform/parse-dashboard",
"bugs": "https://github.com/ParsePlatform/parse-dashboard/issues",
"version": "1.0.25",
"repository": {
"type": "git",
"url": "https://github.com/ParsePlatform/parse-dashboard"
},
"license": "SEE LICENSE IN LICENSE",
"files": [
"Parse-Dashboard",
"bin",
"README.md",
"LICENSE"
],
"dependencies": {
"bcryptjs": "^2.3.0",
"body-parser": "^1.15.2",
"commander": "^2.9.0",
"connect-flash": "^0.1.1",
"cookie-session": "^2.0.0-alpha.1",
"csurf": "^1.9.0",
"express": "^4.13.4",
"json-file-plus": "^3.2.0",
"package-json": "^2.3.1",
"passport": "^0.3.2",
"passport-local": "^1.0.0",
"webpack": "~1.12.0"
},
"devDependencies": {
"babel-core": "~5.8.12",
"babel-loader": "~5.3.0",
"babel-plugin-remove-proptypes": "~1.0.0",
"babel-polyfill": "^6.7.2",
"babel-runtime": "~5.8.25",
"css-loader": "~0.18.0",
"file-loader": "^0.8.5",
"history": "^2.1.2",
"http-server": "~0.8.5",
"immutable": "~3.7.5",
"immutable-devtools": "~0.0.4",
"jest-cli": "^12.0.2",
"js-beautify": "~1.5.0",
"marked": "^0.3.5",
"node-sass": "^3.7.0",
"parse": "1.6.14",
"prismjs": "~1.2.0",
"react": "^15.0.1",
"react-addons-test-utils": "^15.0.1",
"react-dnd": "~2.1.4",
"react-dnd-html5-backend": "~2.0.0",
"react-dom": "^15.0.1",
"react-router": "^2.6.0",
"request-promise": "^4.1.1",
"sass-loader": "~3.1.2",
"style-loader": "~0.12.3",
"svg-prep": "~1.0.0",
"transform-jest-deps": "^2.1.0",
"webpack": "~1.12.0"
},
"scripts": {
"dev": "node ./Parse-Dashboard/index.js & webpack --config webpack/build.config.js --devtool eval-source-map --progress --watch",
"dashboard": "node ./Parse-Dashboard/index.js & webpack --config webpack/build.config.js --progress --watch",
"pig": "http-server ./PIG -p 4041 -s & webpack --config webpack/PIG.config.js --progress --watch",
"build": "NODE_ENV=production webpack --config webpack/production.config.js && webpack --config webpack/PIG.config.js",
"test": "NODE_PATH=./node_modules jest",
"generate": "node scripts/generate.js",
"prepublish": "webpack --config webpack/publish.config.js",
"start": "node ./Parse-Dashboard/index.js"
},
"bin": {
"parse-dashboard": "./bin/parse-dashboard"
},
"engines": {
"node": "7.6.0"
},
"main": "Parse-Dashboard/app.js",
"jest": {
"testPathDirs": [
"src/lib"
],
"scriptPreprocessor": "<rootDir>/testing/preprocessor.js",
"testDirectoryName": "tests",
"testFileExtensions": [
"test.js"
],
"unmockedModulePathPatterns": [
"react",
"react-dom",
"react-addons-test-utils",
"fbjs"
]
}
}
If I run "npm install" at the root level of this project, I will get this error:
npm WARN prepublish-on-install As of npm#5, `prepublish` scripts will run only for `npm publish`.
npm WARN prepublish-on-install (In npm#4 and previous versions, it also runs for `npm install`.)
npm WARN prepublish-on-install See the deprecation note in `npm help scripts` for more information.
> parse-dashboard#1.0.25 prepublish /mypath/-dashboard-advanced
> webpack --config webpack/publish.config.js
sh: webpack: command not found
npm ERR! addLocal Could not install /mypath/-dashboard-advanced
npm ERR! addLocal Could not install /mypath/-dashboard-simple
npm WARN Local package.json exists, but node_modules missing, did you mean to install?
npm ERR! Darwin 16.5.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install"
npm ERR! node v7.6.0
npm ERR! npm v4.1.2
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! parse-dashboard#1.0.25 prepublish: `webpack --config webpack/publish.config.js`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the parse-dashboard#1.0.25 prepublish script 'webpack --config webpack/publish.config.js'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the parse-dashboard package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! webpack --config webpack/publish.config.js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs parse-dashboard
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls parse-dashboard
npm ERR! There is likely additional logging output above.
So my understanding is that the webpack is needed in prepublish script but it is not found. But I have intentionally added webpack as dependencies in both root project or the local module (in both dev and production dependencies just to be safe), why is webpack still not found?

npm fails when installing gulp-typescript on Azure

I'm trying to deploy my Azure AppService. The application is written using TypeScript (both server and client). When deploying everything works ok until it's installing gulp-typescript. This is used to transpile TypeScript code as part of postinstall script.
Package.json:
{
"name": "test-webapp",
"version": "1.0.0",
"description": "Test Application",
"engines": {
"node": "4.4.6"
},
"main": "server.js",
"scripts": {
"start": "node server/server.js",
"typings": "typings",
"postinstall": "node node_modules/bower/bin/bower install && npm run typings install && node node_modules/gulp/bin/gulp.js ts-compile"
},
"author": {
"name": "liskaj",
"email": ""
},
"dependencies": {
"body-parser": "^1.15.2",
"bower": "^1.7.9",
"cors": "^2.7.1",
"express": "^4.14.0",
"express-session": "^1.14.0",
"gulp": "^3.9.1",
"gulp-sourcemaps": "^1.6.0",
"gulp-typescript": "^2.13.6",
"request": "^2.73.0",
"typescript": "^1.8.10",
"typings": "^1.3.2",
"winston": "^2.2.0"
}
}
Azure log output:
remote: npm ERR! node v4.4.6
remote: npm ERR! npm v2.15.5
remote: npm ERR! path D:\home\site\wwwroot\node_modules\gulp-typescript\node_modules\vinyl-fs\node_modules\globstream\node_modules\micromatch\node_modules\braces\node_modules\expand-range\node_modules\fill-range\node_modules\isobject\node_modules\isarray\package.json.3240780430
remote: npm ERR! code EINVAL
remote: npm ERR! errno -4071
remote: npm ERR! syscall rename
remote:
remote: npm ERR! EINVAL: invalid argument, rename 'D:\home\site\wwwroot\node_modules\gulp-typescript\node_modules\vinyl-fs\node_modules\glob-stream\node_modules\micromatch\node_modules\braces\node_modules\expand-range\node_modules\fill-range\node_modules\isobject\node_modules\isarray\package.json.3240780430' -> 'D:\home\site\wwwroot\node_modules\gulp-typescript\node_modules\vinyl-fs\node_modules\glob-stream\node_modules\micromatch\node_modules\braces\node_modules\expand-range\node_modules\fill-range\node_modules\isobject\node_modules\isarray\package.json
This works fine locally (Windows 7 + Windows 10) and also on Heroku.

Npm start doesn't work in an Angular 2 and Laravel 5 project

I am working on a Laravel 5.2 and Angular 2 project and I've just finished setting up angular but when running npm start, I get the following error :
npm ERR! Windows_NT 6.1.7601
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install"
npm ERR! node v4.4.7
npm ERR! npm v2.15.8
npm ERR! code ELIFECYCLE
npm ERR! # postinstall: `typings install`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the # postinstall script 'typings install'.
npm ERR! This is most likely a problem with the package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! typings install
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!
npm ERR! npm owner ls
npm ERR! There is likely additional logging output above.
Can you guys help me ?
This is the content of my package.json :
{
"private": true,
"scripts": {
"prod": "gulp --production",
"dev": "gulp watch",
"start": "tsc && concurrently \"npm run tsc:w\" \"npm run lite\" ",
"lite": "lite-server",
"postinstall": "typings install",
"tsc": "tsc",
"tsc:w": "tsc -w",
"typings": "typings"
},
"devDependencies": {
"gulp": "^3.9.1",
"laravel-elixir": "^5.0.0",
"bootstrap-sass": "^3.0.0",
"concurrently": "^1.0.0",
"del": "^2.2.0"
},
"dependencies": {
"angular2": "2.0.0-beta.0",
"bootstrap-sass": "^3.0.0",
"elixir-typescript": "^1.1.2",
"es6-promise": "^3.0.2",
"es6-shim": "^0.33.3",
"laravel-elixir": "^4.0.0",
"reflect-metadata": "0.1.2",
"rxjs": "5.0.0-beta.0",
"systemjs": "0.19.6",
"zone.js": "0.5.10"
}
}
Your script is failing while trying to run 'typings install'.
1. Include typings in devDependencies
{
"devDependencies": {
"concurrently": "^2.0.0",
"lite-server": "^2.2.0",
"typescript": "^1.8.10",
"typings": "^1.0.4"
}
}
Run npm install
Create typings.json as below
{
"globalDependencies": {
"core-js": "registry:dt/core-js#0.0.0+20160602141332",
"jasmine": "registry:dt/jasmine#2.2.0+20160621224255",
"node": "registry:dt/node#6.0.0+20160807145350"
}
}
npm start
if you still having issue install typings globally
npm install typings --global
I too face this problem i do the following steps
1. i uninstall nodejs and install the latest version.
2. close the command promt and open.
3. execute npm install
4. execute npm build(not nesessery)
5. execute npm start
This works for me.

node.js version issue or something else

I have
"node":"0.10.12",
"npm":"1.2.30"
in my package and i have installed
node 0.10.26
and
npm 1.4.7
and having an
error Failed at the Kiwi-Move-API#0.0.1 start script.
npm ERR! This is most likely a problem with the Kiwi-Move-API package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node server.js
npm ERR! You can get their info via:
npm ERR! npm owner ls Kiwi-Move-API
npm ERR! There is likely additional logging output above.
npm ERR! System Linux 3.8.0-35-generic
npm ERR! command "node" "/usr/local/bin/npm" "start"
npm ERR! cwd /home/asnadatta/work/kiwi/kiwi-devkit
npm ERR! node -v v0.10.26
npm ERR! npm -v 1.4.7
npm ERR! code ELIFECYCLE
this is my complete package
{
"name": "Kiwi-Move-API",
"version": "0.0.1",
"description": "Kiwi Move Webservices API",
"main": "server.js",
"engines": {
"node":"0.10.12",
"npm":"1.2.30"
},
"dependencies": {
"express": "~3.3.4",
"mongoose": "~3.6.14",
"mongo": "~0.1.0",
"redis": "~0.8.4",
"ws": "~0.4.27",
"mocha": "~1.12.0",
"bcrypt": "0.7.6",
"node-oauth2-server":"1.5.0",
"underscore":"1.5.1",
"nodemailer":"0.5.2",
"should":"1.2.2",
"request":"2.25.0",
"nano": "~4.1.4"
},
"devDependencies": {},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "node server.js"
},
"keywords": [
"Kiwi",
"Move",
"Kiwi",
"Wearable",
"Tech"
],
"author": "Mike Holmes",
"license": "BSD"
}
Is this versions issue or some thing else

Resources