package.json

Pass argument from script to gulp task

耗尽温柔 提交于 2019-12-20 04:37:22
问题 I have package.json scripts with the following structure: "scripts": { "watch:build": "tsc --watch", "watch:server": "nodemon ./src/app.js --watch 'app'", "build": "tsc && gulp do_something", "start": "npm-run-all clean build --parallel watch:build", "watch:server --print-label" } I would like to start the application as npm run start with_argument and pass it to build script, to perform actions in the gulp task based on that argument. I read a lot of tutorial and how to articles, but without

Why does `DEBUG=foo node index.js` fails in `scripts` section of `package.json`

不羁的心 提交于 2019-12-20 03:45:09
问题 I'm on Windows 10, but I'm using git bash . When running from git bash the following: DEBUG=foo node index.js it works fine and sets the environment variable DEBUG . But if I put it into the scripts section of the package.json : "scripts": { "start": "DEBUG=foo node index.js" }, and run the following from git bash I get the following error: $ npm start > nodejs@1.0.0 start C:\Users\maksym.koretskyi\Desktop\nodejs > DEBUG=foo node index.js 'DEBUG' is not recognized as an internal or external

how to execute powershell ps1 scripts from package.json “scripts”?

限于喜欢 提交于 2019-12-19 05:21:44
问题 How can I execute PowerShell ps1 scripts from package.json "scripts"? I know how to set up a basic script in package.json "scripts". For example with the following configuration, I can exec npm run test which will output "this is only a test" to the console: "scripts": { "test": "echo \"this is only a test\"" } However, I have a more advanced scenario where I'd like to execute a PowerShell script. Something like this: "scripts": { "buildAngular": "buildAngular.ps1" } Can I exec a ps1 script

How to npm publish specific folder but as package root

六眼飞鱼酱① 提交于 2019-12-18 10:58:38
问题 I have a project that include a gulp task for building and packaging the sources and release in a directory called dist . My goal is publish it as a npm package, but only my dist folder. The npm documentation says that I can use the files tag to specify files to export. It works. But, documentation also says that: If you name a folder in the array, then it will also include the files inside that folder The result, is a npm package, which node_modules looks like: But I'd like to see all my

Npm peer dependency error

蓝咒 提交于 2019-12-18 07:42:13
问题 I am getting the npm peer dependency error repeatedly with npm install command . This is my package.json on which i have unmet peer dependency on react and webpack npm WARN react-datepicker@0.25.0 requires a peer of react@^0.14.0 but none was installed. npm WARN babel-loader@6.2.4 requires a peer of webpack@1 || ^2.1.0-beta but none was installed. npm WARN desktop-react@1.0.0 No repository field. npm WARN desktop-react@1.0.0 license should be a valid SPDX license expression { "name":

Whats the difference when configuring webpack babel-loader vs configuring it within package.json?

ぐ巨炮叔叔 提交于 2019-12-18 06:06:28
问题 Hi please help me understand the differences between setting babel config inside .babelrc vs webpack loader options, vs inserting it in package.json. For example, Would it make any difference if I put the presets in the webpack babel-loader options vs package.json or a separate .babelrc config file? In webpack config: { test: /\.(js|jsx|mjs)$/, loader: require.resolve('babel-loader'), options: { "presets": [ "react-app" ] }, }, In package json: "babel": { "presets": [ "react-app" ] }, 回答1:

How to set env var for .npmrc use

血红的双手。 提交于 2019-12-18 04:16:47
问题 I need a module in my project to download a private npm package. To accomplish this, I am using a .npmrc file to supply a read-only token needed to download the package. To keep the token supplied by npm out of the file, I wish to add it as an environment variable and let it expand in the file. E.g: # .npmrc //registry.npmjs.org/:_authToken=${NPM_TOKEN} I can't figure out how to get that NPM_TOKEN added to the env before it is referenced for the install. I tried using an npm preinstall script

How to set env var for .npmrc use

[亡魂溺海] 提交于 2019-12-18 04:16:06
问题 I need a module in my project to download a private npm package. To accomplish this, I am using a .npmrc file to supply a read-only token needed to download the package. To keep the token supplied by npm out of the file, I wish to add it as an environment variable and let it expand in the file. E.g: # .npmrc //registry.npmjs.org/:_authToken=${NPM_TOKEN} I can't figure out how to get that NPM_TOKEN added to the env before it is referenced for the install. I tried using an npm preinstall script

npm glob pattern not matching subdirectories

北城余情 提交于 2019-12-17 16:34:16
问题 In my package.json , I have a scripts block that uses **/*Test.js to match files. When run via npm , they do not match sub-directories more than one level. When executed on the command line directly, they work as expected. Can anyone explain what is happening, and provide a workaround or solution? package.json { "name": "immutable-ts", "scripts": { "test": "echo mocha dist/**/*Test.js", } } Execution % npm run test > immutable-ts@0.0.0 test:unit .../immutable-ts > echo mocha dist/**/*Test.js

Error: EPERM: operation not permitted, unlink 'D:\Sources\**\node_modules\fsevents\node_modules\abbrev\package.json'

早过忘川 提交于 2019-12-17 15:49:09
问题 I just updated npm to 5.4.0 . Now, Whenever I want install a npm package I get the following error: D:\Sources\DownloadCms\Md.Download\Web.Angular>npm install mds.angular.datetimepicker@latest --save npm ERR! path D:\Sources\DownloadCms\Md.Download\Web.Angular\node_modules\fsevents\node_modules\abbrev\package.json npm ERR! code EPERM npm ERR! errno -4048 npm ERR! syscall unlink npm ERR! Error: EPERM: operation not permitted, unlink 'D:\Sources\DownloadCms\Md.Download\Web.Angular\node_modules