2

我想在我的 package.json 中创建一个符号链接:

“安装后”:“ln -s ../../dist foo/dist”

但是什么也没有出现。

命令在终端中运行良好。

也许我应该使用终端模拟器来满足 Windows 的需求?

4

1 回答 1

0

System: Ubuntu 16 Npm: 3.5.2

In file package.json I have

{
  "scripts": {
    "postinstall": "ln -fs a b"
  }
}

In catalog I have the following files

ls -la
drwxrwxr-x   6 daniel daniel 4096 maj 15 09:51 .
drwxrwxr-x   4 daniel daniel 4096 maj 14 21:26 ..
-rw-rw-r--   1 daniel daniel    0 maj 15 09:50 a
-rw-rw-r--   1 daniel daniel   55 maj 15 09:50 package.json

I use command

npm install

That prints

 undefined postinstall /home/daniel
 ln -fs a b

npm WARN optional Skipping failed optional dependency /chokidar/fsevents:
npm WARN notsup Not compatible with your operating system or architecture: fsevents@1.1.1
npm WARN frontend No repository field.
npm WARN frontend No license

Then I list files again:

ls -la
drwxrwxr-x   6 daniel daniel 4096 maj 15 09:51 .
drwxrwxr-x   4 daniel daniel 4096 maj 14 21:26 ..
-rw-rw-r--   1 daniel daniel    0 maj 15 09:50 a
lrwxrwxrwx   1 daniel daniel    1 maj 15 09:51 b -> a
-rw-rw-r--   1 daniel daniel   55 maj 15 09:50 package.json

Try reproduce these commands and let me know if it helps.

于 2017-05-15T07:57:45.167 回答