node can not find webpack module on windows 10 - node.js

I have installed webpack both globally (first) and for a certain project also (PC, windows 10). Seems that the project dir contains all the folders that it needed:
c:\Users\srgg6701\Documents\Projects\Compilers\Webpack\try>npm install webpack --save-dev
npm WARN optional dep failed, continuing fsevents#1.0.5
webpack#1.12.9 node_modules\webpack
├── interpret#0.6.6
├── clone#1.0.2
├── tapable#0.1.10
├── async#1.5.0
├── esprima#2.7.0
├── enhanced-resolve#0.9.1 (graceful-fs#4.1.2, memory-fs#0.2.0)
├── supports-color#3.1.2 (has-flag#1.0.0)
├── mkdirp#0.5.1 (minimist#0.0.8)
├── optimist#0.6.1 (wordwrap#0.0.3, minimist#0.0.10)
├── memory-fs#0.3.0 (errno#0.1.4, readable-stream#2.0.4)
├── webpack-core#0.6.8 (source-list-map#0.1.5, source-map#0.4.4)
├── loader-utils#0.2.12 (big.js#3.1.3, json5#0.4.0)
├── uglify-js#2.6.1 (async#0.2.10, uglify-to-browserify#1.0.2, source-map#0.5.3, yargs#3.10.0)
├── node-libs-browser#0.5.3 (tty-browserify#0.0.0, https-browserify#0.0.0, path-browserify#0.0.0, constants-browserify#0.0.1, punycode#1.3.2, string_decoder#0.10.31, os-browserify#0.1.2, process#0.11.2, domain-browser#1.1.4, assert#1.3.0, querystring-es3#0.2.1, timers-browserify#1.4.1, stream-browserify#1.0.0, events#1.1.0, readable-stream#1.1.13, util#0.10.3, console-browserify#1.1.0, url#0.10.3, vm-browserify#0.0.4, http-browserify#1.7.0, browserify-zlib#0.1.4, buffer#3.5.4, crypto-browserify#3.2.8)
└── watchpack#0.2.9 (graceful-fs#4.1.2, async#0.9.2, chokidar#1.4.0)
But when I run the command in the project dir:
c:\Users\srgg6701\Documents\Projects\Compilers\Webpack\try>node webpack ./app.js bundle.js
It reveals an error:
module.js:338
throw err;
^
Error: Cannot find module 'c:\Users\srgg6701\Documents\Projects\Compilers\Webpack\try\webpack'
at Function.Module._resolveFilename (module.js:336:15)
at Function.Module._load (module.js:286:25)
at Function.Module.runMain (module.js:475:10)
at startup (node.js:117:18)
at node.js:951:3
Then I check installed package for node:
c:\Users\srgg6701\Documents\Projects\Compilers\Webpack\try>npm ls --depth=0
It says that's OK (?):
c:\Users\srgg6701\Documents\Projects\Compilers\Webpack\try
└── webpack#1.12.9
Nevertheless, the error remains.
Pls, tell me, can it be fixed and how?!
Just in case, here is the content of the node_modules/webpack/package.json file:
{
"name": "webpack",
"version": "1.12.9",
"author": {
"name": "Tobias Koppers #sokra"
},
"description": "Packs CommonJs/AMD modules for the browser. Allows to split your codebase into multiple bundles, which can be loaded on demand. Support loaders to preprocess files, i.e. json, jade, coffee, css, less, ... and your custom stuff.",
"dependencies": {
"async": "^1.3.0",
"clone": "^1.0.2",
"enhanced-resolve": "~0.9.0",
"esprima": "^2.5.0",
"interpret": "^0.6.4",
"loader-utils": "^0.2.11",
"memory-fs": "~0.3.0",
"mkdirp": "~0.5.0",
"node-libs-browser": ">= 0.4.0 <=0.6.0",
"optimist": "~0.6.0",
"supports-color": "^3.1.0",
"tapable": "~0.1.8",
"uglify-js": "~2.6.0",
"watchpack": "^0.2.1",
"webpack-core": "~0.6.0"
},
"license": "MIT",
"devDependencies": {
"benchmark": "^1.0.0",
"bundle-loader": "~0.5.0",
"codecov.io": "^0.1.2",
"coffee-loader": "~0.7.1",
"coffee-script": "^1.10.0",
"component-webpack-plugin": "~0.2.0",
"coveralls": "^2.11.2",
"css-loader": "~0.15.0",
"diff": "^2.0.2",
"eslint": "^1.1.0",
"eslint-plugin-nodeca": "^1.0.3",
"express": "~4.13.1",
"extract-text-webpack-plugin": "~0.8.0",
"file-loader": "~0.8.0",
"glob": "^5.0.14",
"i18n-webpack-plugin": "~0.2.0",
"istanbul": "^0.3.13",
"jade": "^1.11.0",
"jade-loader": "~0.7.0",
"js-beautify": "^1.5.10",
"json-loader": "~0.5.1",
"less": "^2.5.1",
"less-loader": "^2.0.0",
"mocha": "~2.2.0",
"mocha-lcov-reporter": "0.0.2",
"raw-loader": "~0.5.0",
"script-loader": "~0.6.0",
"should": "^7.0.2",
"style-loader": "~0.12.0",
"url-loader": "~0.5.0",
"val-loader": "~0.5.0",
"vm-browserify": "~0.0.0",
"webpack-dev-middleware": "^1.0.0",
"worker-loader": "~0.6.0"
},
"engines": {
"node": ">=0.6"
},
"repository": {
"type": "git",
"url": "git+https://github.com/webpack/webpack.git"
},
"homepage": "https://github.com/webpack/webpack",
"main": "lib/webpack.js",
"web": "lib/webpack.web.js",
"bin": {
"webpack": "./bin/webpack.js"
},
"files": [
"lib/",
"bin/",
"buildin/",
"hot/",
"web_modules/"
],
"scripts": {
"pretest": "npm run lint && npm run beautify-lint",
"test": "mocha",
"travis": "npm run cover -- --report lcovonly",
"lint": "eslint lib bin hot scripts",
"beautify-lint": "node ./scripts/beautify-check",
"beautify": "node ./scripts/beautify-rewrite",
"precover": "npm run lint && npm run beautify-lint",
"cover": "istanbul cover -x *.runtime.js node_modules/mocha/bin/_mocha",
"publish-patch": "npm run lint && npm run beautify-lint && mocha && npm version patch && git push && git push --tags && npm publish"
},
"gitHead": "9766f2bde3c3f3e7b3b0e914c9cb81ea3a12e823",
"bugs": {
"url": "https://github.com/webpack/webpack/issues"
},
"_id": "webpack#1.12.9",
"_shasum": "2a031d66189839cc5cbf2c68f80566da2e14ff4e",
"_from": "webpack#*",
"_npmVersion": "2.10.1",
"_nodeVersion": "0.12.4",
"_npmUser": {
"name": "sokra",
"email": "tobias.koppers#googlemail.com"
},
"maintainers": [
{
"name": "sokra",
"email": "tobias.koppers#googlemail.com"
}
],
"dist": {
"shasum": "2a031d66189839cc5cbf2c68f80566da2e14ff4e",
"tarball": "http://registry.npmjs.org/webpack/-/webpack-1.12.9.tgz"
},
"directories": {},
"_resolved": "https://registry.npmjs.org/webpack/-/webpack-1.12.9.tgz",
"readme": "ERROR: No README data found!"
}

When you install a module globally npm install -g webpack (as is required by webpack), it actually becomes available on your command line. So you just need to run:
webpack ./app.js bundle.js
As for the error which you were getting when running:
node webpack ./app.js bundle.js
that's because when you run node webpack you're actually (supposedly) passing the file webpack.js (or webpack/index.js) to node, hence the "Cannot find module" error.

Related

Jovo Could not resolve “vscode” error when I try to deploy

I’m trying to deploy my Jovo project to AWS Lambda using the command: “jovo deploy:code serverless” and I get “Could not resolve “vscode” error” at various locations in the node_modules folder.
Example:
X [ERROR] Could not resolve “vscode”`
node_modules/#alexa/acdl/dist/cjs/extension.js:30:27: 30 │ const vscode = require(“vscode”);
╵ ~~~~~~~~`
You can mark the path “vscode” as external to exclude it from the bundle, ``which will remove this error. You can also surround this “require” call with a try/catch block to handle this failure at run-time instead of bundle-time.`
X [ERROR] Could not resolve “vscode”`
node_modules/vscode-languageclient/lib/node/main.js:22:25: 22 │ const vscode_1 = require(“vscode”);
╵ ~~~~~~~~`
You can mark the path “vscode” as external to exclude it from the bundle, which will remove this error. You can also surround this “require” call with a try/catch block to handle this failure at run-time instead of `bundle-time.
I used “jovo build:serverless” to build the serverless.yaml file.
Any help is appreciated.
Thanks
Package.json file content:
{
"name": "voice-controller",
"private": true,
"description": "test",
"scripts": {
"build": "babel src --out-dir dist",
"start": "node dist/app.dev.js --jovo-webhook",
"start:dev": "nodemon --watch src --exec \"babel src --out-dir dist && node dist/app.dev.js --jovo-webhook\"",
"bundle:dev": "npm run bundle -- dist/app.dev.js",
"prebundle": "rimraf bundle && babel src --out-dir dist",
"bundle": "esbuild --bundle --outfile=bundle/index.js --sourcemap --minify --keep-names --platform=node --target=node16 --format=cjs --external:aws-sdk --external:#oclif/* --external:#jovotech/cli*",
"postbundle": "cd bundle && bestzip ../bundle.zip * && cd ..",
"eslint": "eslint src test --fix",
"test": "jest -c jest.config.js"
},
"author": "jovotech",
"license": "Apache-2.0",
"dependencies": {
"#alexa/acdl": "^0.1.12",
"#jovotech/db-dynamodb": "^4.2.13",
"#jovotech/db-filedb": "^4.0.0",
"#jovotech/framework": "^4.2.15",
"#jovotech/platform-alexa": "^4.2.15",
"#jovotech/platform-googleassistant": "^4.2.13",
"#jovotech/plugin-debugger": "^4.2.14",
"#jovotech/server-express": "^4.0.0",
"#jovotech/target-serverless": "^4.1.6",
"#types/vscode": "^1.67.0",
"async": "^3.2.3",
"esbuild-windows-64": "^0.14.40",
"jovo-db-dynamodb": "^3.6.1",
"jszip": "^3.10.0",
"node-fetch": "^2.6.7",
"vscode-languageclient": "^8.0.1",
"vscode-test": "^1.6.1"
},
"devDependencies": {
"#babel/cli": "^7.14.5",
"#babel/core": "^7.14.6",
"#babel/eslint-parser": "^7.16.3",
"#babel/plugin-proposal-decorators": "^7.14.5",
"#babel/plugin-transform-runtime": "^7.14.5",
"#babel/preset-env": "^7.14.7",
"#babel/register": "^7.14.5",
"#babel/runtime": "^7.14.6",
"#jovotech/cli-command-build": "^4.1.6",
"#jovotech/cli-command-deploy": "^4.1.6",
"#jovotech/cli-command-get": "^4.1.6",
"#jovotech/cli-command-new": "^4.1.6",
"#jovotech/cli-command-run": "^4.1.7",
"#jovotech/cli-core": "^4.0.0",
"#jovotech/filebuilder": "^0.0.1",
"babel-jest": "^27.0.6",
"bestzip": "^2.2.0",
"esbuild": "^0.14.2",
"eslint": "^7.32.0",
"eslint-config-prettier": "^7.1.0",
"eslint-plugin-prettier": "^3.3.1",
"jest": "^26.6.3",
"nodemon": "^2.0.10",
"prettier": "^2.2.1",
"rimraf": "^3.0.2"
},
"repository": {
"type": "git",
"url": "git+https://github.com/jovotech/jovo-framework.git"
},
"bugs": {
"url": "https://github.com/jovotech/jovo-framework"
},
"homepage": "https://github.com/jovotech/jovo-v4-template-js/issues#readme"
}

Yarn uses wrong dependecy

Since I've updated to yarn berry via: yarn set version berry I cannot run my project, the dependency tree is somehow broken. For ease I've provided examples for react-router but this happends with other packages too.
I have a monorepo with this structure:
/
|- .yarn
|- node_modules
|- common/
|- backoffice/
|- frontoffice/
|- test
|- .yarnrc.yml
|- package.json
|- lerna.json
frontoffice and backoffice are react apps. While common have the shared interfaces and components.
backoffice depends on react-router#5 and is writtenn in typescript while the frontoffice depends on react-router#6-beta and is ES5.
When I try to start the backoffice or the frontoffice I have the errors:
$ cd packages/frontoffice
$ yarn start
Failed to compile.
Attempted import error: 'Redirect' is not exported from 'react-router'.
In fact the backoffice is using react-router#v6 and frontoffice is using react-router#5
when I try to start the backoffice I get the error:
Type '{ path: any; render: (props: any) => Element; }' is not assignable to type 'IntrinsicAttributes & Pick<RouteProps, "path" | "children" | "caseSensitive" | "element"> & Pick<InferProps<{ caseSensitive: Requireable<boolean>; childr
en: Requireable<...>; element: Requireable<...>; path: Requireable<...>; }>, never> & Pick<...>'.
Property 'render' does not exist on type 'IntrinsicAttributes & Pick<RouteProps, "path" | "children" | "caseSensitive" | "element"> & Pick<InferProps<{ caseSensitive: Requireable<boolean>; children: Requireable<...>; element: Require
able<...>; path: Requireable<...>; }>, never> & Pick<...>'. TS2322
Also the IDE is highlighting the code, with errors everywhere on all packages.
I've run the lerna why command and to me everything seems fine:
$ yarn why react
├─ #mymonorepo/backoffice#workspace:packages/backoffice
│ └─ react#npm:17.0.1 (via npm:^17.0.1)
│
├─ #mymonorepo/test#workspace:packages/test
│ └─ react#npm:17.0.1 (via npm:^17.0.1)
│
├─ #mymonorepo/frontoffice#workspace:packages/frontoffice
│ └─ react#npm:17.0.1 (via npm:17.0.1)
│
└─ react-dragscroll#npm:2.0.1
└─ react#npm:16.14.0 (via npm:^16.1.1)
$ yarn why react-router
├─ #mymonorepo/backoffice#workspace:packages/backoffice
│ └─ react-router#npm:5.2.1 [1602b] (via npm:^5.2.0 [1602b])
│
├─ #mymonorepo/test#workspace:packages/test
│ └─ react-router#npm:5.2.1 [1602b] (via npm:^5.2.0 [1602b])
│
├─ #mymonorepo/frontoffice#workspace:packages/frontoffice
│ └─ react-router#npm:6.0.0-beta.0 [46813] (via npm:6.0.0-beta.0 [46813])
│
├─ react-router-dom#npm:5.3.0
│ └─ react-router#npm:5.2.1 (via npm:5.2.1)
│
├─ react-router-dom#npm:6.0.0-beta.0
│ └─ react-router#npm:6.0.0-beta.0 (via npm:6.0.0-beta.0)
│
├─ react-router-dom#npm:5.3.0 [1602b]
│ └─ react-router#npm:5.2.1 [1602b] (via npm:^5.2.0 [1602b])
│
└─ react-router-dom#npm:6.0.0-beta.0 [46813]
└─ react-router#npm:6.0.0-beta.0 [46813] (via npm:6.0.0-beta.0 [46813])
$ yarn why react-router-dom
├─ #mymonorepo/backoffice#workspace:packages/backoffice
│ └─ react-router-dom#npm:5.3.0 [1602b] (via npm:^5.2.0 [1602b])
│
├─ #mymonorepo/test#workspace:packages/test
│ └─ react-router-dom#npm:5.3.0 [1602b] (via npm:^5.2.0 [1602b])
│
└─ #mymonorepo/frontoffice#workspace:packages/frontoffice
└─ react-router-dom#npm:6.0.0-beta.0 [46813] (via npm:6.0.0-beta.0 [46813])
$
Did I forget something to configure? Is there a way to force the right version for each package?
the nodeLinker option in .yarnrc.yml is set to node-modules
the pakage.json are the following:
/package.json
{
"name": "mymonorepo",
"version": "0.1.0",
"license": "MIT",
"private": true,
"workspaces": {
"packages": [
"packages/*"
]
},
"resolutions": {
"graphql": "^15.3.0"
},
"devDependencies": {
"husky": "^4.3.8",
"lerna": "^3.22.1",
"lint-staged": "^10.5.3"
},
"packageManager": "yarn#3.2.0"
}
/backoffice/package.json
{
"name": "#mymonorepo/backoffice",
"version": "3.0.0",
"private": true,
"dependencies": {
"#apollo/client": "^3.5.8",
"#material-ui/core": "^4.12.1",
"#material-ui/icons": "^4.11.2",
...
"react": "^17.0.0",
"react-admin": "^3.19.7",
"react-app-polyfill": "^2.0.0",
"react-dom": "^17.0.0",
"react-redux": "^7.1.0",
"react-router": "^5.2.0",
"react-router-dom": "^5.2.0",
"react-scripts": "^4.0.0",
"recharts": "^1.8.5",
"redux-saga": "^1.0.0"
},
"scripts": {
"analyze": "source-map-explorer 'build/static/js/*.js'",
"start": "react-scripts start",
"build": "node ./build.js",
"eject": "react-scripts test"
},
"homepage": ".",
"browserslist": [
">0.2%",
"not dead",
"not ie <= 10",
"not op_mini all"
],
"devDependencies": {
"#types/classnames": "^2.3.1",
"#types/fetch-mock": "^7.3.2",
"#types/jest": "^26.0.19",
"#types/node": "^12.12.14",
"#types/query-string": "5.1.0",
"#types/react": "^17.0.20",
"#types/react-dom": "^17.0.9",
"#types/react-router": "^5.2.0",
"#types/react-router-dom": "^5.2.0",
"rewire": "^5.0.0",
"source-map-explorer": "^2.0.0",
"typescript": "^4.4.0"
}
}
/frontoffice/package.json
{
"name": "#mymonorepo/frontoffice",
"version": "2.1.0",
"dependencies": {
"#apollo/client": "^3.1.3",
"#fortawesome/fontawesome-svg-core": "^1.2.35",
"#fortawesome/free-brands-svg-icons": "^5.15.4",
"#fortawesome/free-solid-svg-icons": "^5.15.4",
"#fortawesome/react-fontawesome": "^0.1.15",
...
"react": "17.0.1",
"react-compound-timer": "^1.1.15",
"react-content-loader": "^5.1.4",
"react-custom-scrollbars-2": "^4.3.0",
"react-detect-offline": "^2.4.0",
"react-device-detect": "^1.6.2",
"react-dom": "17.0.1",
"react-fullscreen-image": "^0.0.3",
"react-gtm-module": "^2.0.8",
"react-helmet": "^6.1.0",
"react-router": "6.0.0-beta.0",
"react-router-dom": "6.0.0-beta.0",
"react-router-hash-link": "^2.0.0",
"react-router-modal": "^2.0.0-rc3",
"react-scripts": "^4.0.1",
"react-scroll-trigger": "^0.6.6",
"react-share": "^4.2.1",
"react-show-more-text": "^1.4.6",
"react-ticker": "^1.2.2",
"react-use-dimensions": "^1.2.1",
"react-window": "^1.8.6",
...
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts --max_old_space_size=4096 build --silent",
"test": "react-scripts test",
"eject": "react-scripts eject",
},
"eslintConfig": {
"extends": "react-app"
},
"browserslist": [
">0.2%",
"not dead",
"not ie <= 11",
"not op_mini all"
],
"devDependencies": {
"depcheck": "^1.3.1",
"eslint-config-react-app": "^6.0.0",
"eslint-plugin-flowtype": "^5.2.0",
"eslint-plugin-import": "^2.22.1",
"eslint-plugin-jsx-a11y": "^6.4.1",
"eslint-plugin-prettier": "^3.3.1",
"eslint-plugin-react": "^7.22.0",
"eslint-plugin-react-hooks": "^4.2.0"
}
}

Gulp failed after push

So I did this tutorial,(The basic Azure Cosmos DB (MongoDB) with Node.js)
https://learn.microsoft.com/en-us/azure/app-service-web/app-service-web-tutorial-nodejs-mongodb-app
I didn't changed anything in the code just what tutorial says and after
git push azure master I get
gulp failed(link to image)
Does anyone have any clues from what comes this error?
Edit: deploy.sh Gulp part
if [ -e "$DEPLOYMENT_TARGET/gulpfile.js" ]; then
cd "$DEPLOYMENT_TARGET"
eval ./node_modules/.bin/gulp imagemin
eval ./node_modules/.bin/gulp prod <----I added this line and still fails
exitWithMessageOnError "gulp failed"
cd - > /dev/null
fi
package.json only Gulp part
{
"name": "meanjs",
"description": "Full-Stack JavaScript with MongoDB, Express, AngularJS, and Node.js.",
"version": "0.5.0",
"meanjs-version": "0.5.0",
"private": false,
"author": "https://github.com/meanjs/mean/graphs/contributors",
"license": "MIT",
"repository": {
"type": "git",
"url": "https://github.com/meanjs/mean.git"
},
"engines": {
"node": "6.9.1",
"npm": "3.10.8"
},
"scripts": {
"update": "npm update && npm prune && npm run bower",
"clean": "rm -rf node_modules/ public/lib/",
"reinstall": "npm cache clean && npm run clean && npm install",
"start": "gulp",
"start:prod": "gulp prod",
"start:debug": "node-debug --web-host 0.0.0.0 server.js & gulp debug",
"gulp": "gulp",
"bower": "bower install --allow-root && bower prune --allow-root",
"lint": "gulp lint",
"test": "gulp test",
"test:server": "gulp test:server",
"test:server:watch": "gulp test:server:watch",
"test:client": "gulp test:client",
"test:e2e": "gulp test:e2e",
"test:coverage": "gulp test:coverage",
"postinstall": "npm run bower",
"generate-ssl-certs": "scripts/generate-ssl-certs.sh"
},
"dependencies": {
"passport-google-oauth": "~1.0.0",
"passport-linkedin": "~1.0.0",
"passport-local": "~1.0.0",
"passport-paypal-openidconnect": "~0.1.1",
"passport-twitter": "~1.0.4",
"serve-favicon": "~2.4.2",
"socket.io": "^2.0.2",
"validator": "~7.0.0",
"winston": "^2.3.1",
"wiredep": "~4.0.0"
},
"devDependencies": {
"gulp": "^3.9.1",
"gulp-angular-templatecache": "~2.0.0",
"gulp-autoprefixer": "~3.1.0",
"gulp-concat": "~2.6.0",
"gulp-csslint": "~1.0.0",
"gulp-csso": "~3.0.0",
"gulp-eslint": "~3.0.1",
"gulp-imagemin": "~3.2.0",
"gulp-istanbul": "~1.1.1",
"gulp-less": "~3.3.0",
"gulp-load-plugins": "~1.5.0",
"gulp-mocha": "~3.0.1",
"gulp-ng-annotate": "~2.0.0",
"gulp-nodemon": "~2.2.1",
"gulp-protractor": "^4.0.0",
"gulp-refresh": "~1.1.0",
"gulp-rename": "~1.2.2",
"gulp-rev": "^7.1.2",
"gulp-sass": "~3.1.0",
"gulp-uglify": "~2.1.2",
"gulp-util": "~3.0.7",
}
}
I also get this error on the begin of the push logs
remote: glob error { Error: ENOTSUP: operation not supported on socket, scandir 'D:\home\site\wwwroot\node_modules\phant
omjs-prebuilt\node_modules\request\node_modules\http-signature\node_modules\sshpk\bin\sshpk-conv'
remote: at Error (native)
Edit2: The error changed a bit
remote: An error has occurred during web site deployment.
remote: throw err;
remote: gulp failed
remote: ^
remote: Error: Cannot find module 'readable-stream/transform'
You did install gulp. Make sure you have installed gulp-cli.
And, as mentioned in "no command 'gulp' found - after installation"
Also, node_modules/.bin/ isn't in your %PATH%.
But it is automatically added by npm when running npm scripts (see this blog post for reference).

ember/npm addon with dependencies/ devDependencies

I have created an ember addon which relies on gulp derived packages to build, so in the addon it has the following in package.json.
When the addon is included in the main application, the build fails due to the various gulp modules being missing. The addon is in the devDependencies section of the main application.
The addon also builds into the main application when it is in through npm link. My question is how should the addon dependencies be handled so the main application builds without a local copy of the module?
Update: I think the problem is that the package does a gulp build after the postinstall which elevates the gulp devDependencies into real dependencies. Is this correct?
Addon JSON file
{
"name": "My Addon",
"version": "0.0.0",
"description": "The default blueprint for ember-cli addons.",
"directories": {
"doc": "doc",
"test": "tests"
},
"scripts": {
"build": "ember build",
"start": "ember server",
"test": "ember try:each",
"postinstall": "gulp build && bower install"
},
"repository": {
"type": "git",
"url": "git://github.com/myaddon.git"
},
"engines": {
"node": ">= 0.12.0"
},
"author": "",
"license": "MIT",
"devDependencies": {
"bootstrap": "^4.0.0-alpha.5",
"broccoli-asset-rev": "^2.4.5",
"broccoli-funnel": "^1.0.9",
"ember-ajax": "^2.4.1",
// more ember modules
"find-root": "^0.1.1",
"font-awesome": "^4.7.0",
"glob": "^4.5.3",
"gulp": "^3.9.1",
"gulp-clean-css": "^2.2.1",
"gulp-concat": "^2.6.0",
"gulp-connect": "^2.2.0",
"gulp-filter": "^3.0.1",
"gulp-git": "^1.4.0",
"gulp-rename": "^1.2.2",
"gulp-sass": "^2.3.2",
"gulp-sourcemaps": "^1.5.2",
"gulp-task-loader": "^1.2.1",
"gulp-template": "^3.0.0",
"gulp-uglify": "^1.2.0",
"gulp-zip": "^3.0.2",
"lazypipe": "^1.0.1",
"loader.js": "^4.0.10",
"run-sequence": "^1.1.2"
},
"keywords": [
"ember-addon"
],
"dependencies": {
"ember-cli-babel": "^5.1.7"
},
"ember-addon": {
"configPath": "tests/dummy/config"
}
}
The addon's dependencies are needed to build application (that includes addon), should be listed in dependencies section. The devDependencies of a package that is included as dependency of another package, are ignored.
There is other solution to add packages into an application. You can create a blueprint in your addon that will be called every time an application build with it or install it.

How to resolve gulp dependencies while creating a NPM package

I have a nodeJs application(demo) which using commander package to take command line argument and using gulp for
build
docs
test
coverage
This functionality is working fine but Now I need to move this application as a NPM Package.
Changes are done according to according NPM Package but when I install this as NPM package npm install ../demo/ from local location.
It asks for following gulp dependencies: -
Cannot find module gulp
Cannot find module gulp-load-plugins
Cannot find module del
Cannot find module gulp-plumber
Cannot find module gulp-eslint
Cannot find module babel-eslint
Cannot find module gulp-debug
Cannot find module gulp-sourcemaps
Cannot find module gulp-babel
Every time I go back to the npm package(which i created) directory and run the command which occurs as an error like npm install gulp --save-dev and npm install del --save-dev and so on.
I also defined these dependencies in package.json but it is still throwing errors.
Is there any way to resolve this issue.
package.json
{
"name": "demo",
"version": "0.0.1",
"description": "",
"main": "./dist/index.js",
"license": "SEE LICENSE IN LICENSE.md",
"keywords": [],
"scripts": {
"build": "gulp build",
"coverage": "gulp coverage",
"docs": "gulp docs",
"prepublish": "gulp build",
"test": "gulp test"
},
"dependencies": {
"autobind-decorator": "^1.3.3",
"babel-polyfill": "^6.6.1",
"commander": "^2.9.0",
"lodash": "^4.0.0",
"mustache": "^2.2.1",
"source-map-support": "^0.4.0",
"wrench": "^1.5.8",
"ms": "^0.7.1"
"babel-eslint": "^6.0.4",
"babel-plugin-lodash": "^2.2.1",
"babel-plugin-transform-decorators-legacy": "^1.3.4",
"babel-preset-nodejs-lts": "^1.2.2",
"chai": "^3.5.0",
"del": "^2.2.0",
"esdoc-es7-plugin": "^0.0.3",
"gulp": "^3.9.1",
"gulp-babel": "^6.1.2",
"gulp-babel-istanbul": "^1.1.0",
"gulp-debug": "^2.1.2",
"gulp-esdoc": "^0.2.0",
"gulp-eslint": "^2.0.0",
"gulp-filter": "^4.0.0",
"gulp-inject-modules": "^0.1.1",
"gulp-load-plugins": "^1.2.2",
"gulp-mocha": "^2.2.0",
"gulp-plumber": "^1.1.0",
"gulp-sourcemaps": "^2.0.0-alpha",
"sinon": "^1.17.4",
"sinon-chai": "^2.8.0",
"btoa": "^1.1.2",
"superagent": "^2.1.0"
},
"engines": {
"node": ">=4.0.0"
}
}
I put all the things in dependencies. I tried that way but having same problem.
npm install ../demo/
npm WARN package.json demo_project#1.0.0 No description
npm WARN package.json demo_project#1.0.0 No repository field.
npm WARN package.json demo_project#1.0.0 No README data
> demo#0.0.1 prepublish /work/demo
> gulp build
[16:53:33] Local gulp not found in ~/work/demo
[16:53:33] Try running: npm install gulp
Although the documentation doesn't mention it, npm install folder only installs dependencies and not devDependencies. This may be a little bit confusing as running npm install inside the package folder installs both dependenciesand devDependencies.
So try to install gulpand all the rest as npm install --save gulp (not
--save-dev)
UPDATE: after adding package.json:
everything under devDependencies in your package.json should be under dependencies:
{
"name": "demo",
"version": "0.0.1",
"description": "",
"main": "./dist/index.js",
"license": "SEE LICENSE IN LICENSE.md",
"keywords": [],
"scripts": {
"build": "gulp build",
"coverage": "gulp coverage",
"docs": "gulp docs",
"prepublish": "gulp build",
"test": "gulp test"
},
"dependencies": {
"autobind-decorator": "^1.3.3",
"babel-polyfill": "^6.6.1",
"commander": "^2.9.0",
"lodash": "^4.0.0",
"mustache": "^2.2.1",
"source-map-support": "^0.4.0",
"wrench": "^1.5.8",
"ms": "^0.7.1",
"babel-eslint": "^6.0.4",
"babel-plugin-lodash": "^2.2.1",
"babel-plugin-transform-decorators-legacy": "^1.3.4",
"babel-preset-nodejs-lts": "^1.2.2",
"chai": "^3.5.0",
"del": "^2.2.0",
"esdoc-es7-plugin": "^0.0.3",
"gulp": "^3.9.1",
"gulp-babel": "^6.1.2",
"gulp-babel-istanbul": "^1.1.0",
"gulp-debug": "^2.1.2",
"gulp-esdoc": "^0.2.0",
"gulp-eslint": "^2.0.0",
"gulp-filter": "^4.0.0",
"gulp-inject-modules": "^0.1.1",
"gulp-load-plugins": "^1.2.2",
"gulp-mocha": "^2.2.0",
"gulp-plumber": "^1.1.0",
"gulp-sourcemaps": "^2.0.0-alpha",
"sinon": "^1.17.4",
"sinon-chai": "^2.8.0",
"btoa": "^1.1.2",
"superagent": "^2.1.0"
},
"engines": {
"node": ">=4.0.0"
}
}

Resources